I'm having a problem with cmake / gcc / Linux.
No matter what I try, I cannot get rid of CMAKE_CXX_FLAGS on my linker line. CMake keeps passing them when invoking g++ in link mode.
I have -fopenmp in my CMAKE_CXX_FLAGS and it must not be present on the link line so g++ doesn't link to gomp (I'm using Intel's iomp5 instead).
Edit: I tried the following the beginning of CMakeLists.txt, didn't help:
set(CMAKE_CXX_LINK_EXECUTABLE
"<CMAKE_CXX_COMPILER> <FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
Thanks
CMAKE_CXX_LINK_EXECUTABLE
should help. Show what have you tried (in form of minimal reproducible example). Also, as suggested [in that answer] for similar question, you may useCOMPILE_FLAGS
property for compiler-only options. – Snyder