[CMake] set_target_properties to target openmp flag on an executable

Rolf Eike Beer eike at sf-mail.de
Fri Mar 18 09:47:52 EDT 2011


> Hi all,
>
> Since I have several targets to compile, I was looking for a way to
> set some specific flags to one target among all others. In my example
> I would like to set the openmp flag to the target test and I got an
> error with the code below:
>
> ----------------------------------------------------------------------------------------------
> PROJECT(test CXX)
> ADD_EXECUTABLE(test test.cpp)
> SET_TARGET_PROPERTIES(test PROPERTIES COMPILE_FLAGS "-fopenmp")

I'm just guessing here: try passing this flag also as linker flag. The CXX
flags get also passed to the linker and it looks as if the linker needs to
add the proper functions.

Eike


More information about the CMake mailing list