[CMake] OpenMP compiler flag questoin

Michael Wild themiwi at gmail.com
Fri Nov 13 08:47:16 EST 2009


On 13. Nov, 2009, at 14:21 , Johannes Stallkamp wrote:

> Hello,
>
> if I use
> FIND_PACKAGE( OpenMP )
>
> I get the variables OpenMP_C_FLAGS and OpenMP_CXX_FLAGS correctly set
> to "/openmp" for VC2005.
> Is it correct behaviour that these are not automatically added to the
> CMAKE_CXX_FLAGS_[RELEASE|DEBUG....] variables (and thus, the option is
> not configured in VC's project file)?
>
> Regards
> Johannes
>

Yes, because you might not want to compile ALL of your targets with  
these flags. Either do the following if you want to add it to all  
targets which are after this definition (including sub-directories,  
but not parent directories)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")

or if you want to be more specific, set the COMPILE_FLAGS target  
property.


HTH

Michael


More information about the CMake mailing list