[CMake] Different CMAKE_CXX_FLAGS for different executables

David Doria daviddoria at gmail.com
Fri Mar 25 10:36:48 EDT 2011


> Could you post the output of "make VERBOSE=1"?
>
> On *nix, the following CMakeLists.txt works as expected:
> The output of "make VERBOSE=1" contains:
>
>> .../c++ -DUNIX -o .../SetTargetProperties.cxx.o -c .../SetTargetProperties.cxx

It is working properly now. I must not have done a 'make clean'.

> BTW, preprocessor definitions like "-DUNIX" should be set via the
> COMPILE_DEFINITIONS properties instead of the COMPILE_FLAGS ones.

It seems to generate exactly the same thing if I use

set_target_properties(CompilerFlags PROPERTIES COMPILE_FLAGS "-DUNIX")

and

set_target_properties(CompilerFlags PROPERTIES COMPILE_DEFINITIONS "UNIX")

After reading the documentation you set certainly sounds like I should
use the COMPILE_DEFINITIONS version, but is there a difference?

Thanks again,

David


More information about the CMake mailing list