[CMake] Can't Remove CXX_FLAGS entry

Stephen Kelly steveire at gmail.com
Wed Oct 30 07:37:47 EDT 2013


Yngve Inntjore Levinsen wrote:

> Hi,
> 
> Have a look at the very silly hello world example attached. As I think
> you mentioned, the cmake way to do this is to have targets with specific
> flags in separate folders.

The CMake 2.8.12 way to do this is to use target_compile_options(). Then you 
can have the stuff in one CMakeLists file if you wish:

 add_libary(foo ...)
 target_compile_options(foo PRIVATE -fopenmp)

 add_library(bar ...)
 target_compile_options(bar PRIVATE -Wall)

Thanks,

Steve.




More information about the CMake mailing list