how can I fix this in CMakeList.txt? I have explicitly change target_link_libraries to .so, but during parallel build, if .a is generated first, it is possbile that .a is used, and make the build fail, is this bug of cmake?
It seems like the build graph is not well-defined if this can happen. Inside of CMake code, using the target names rather than -L/path -llibname would avoid any confusion like this. I’m not sure how the ambiguous command line ends up appearing though.