On 03/25/2011 03:36 PM, David Doria wrote: >> 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
For simple defines, i.e. without "=" sign, COMPILE_FLAGS with "-D" and COMPILE_DEFINITIONS without "-D" should act equivalently. However, the latter cares about the correct escaping for more complex definitions, i.e. -DXYZ=\"...\" and the like. Furthermore, COMPILE_DEFINITIONS has configuration-specific variants and is also available as a directory property. Finally, it is list-oriented while COMPILE_FLAGS is space- separated. Thus, COMPILE_DEFINITIONS is preferable for preprocessor definitions while COMPILE_FLAGS should be reserved for non-define flags - as long as it doesn't become obsolete anyway due to the envisaged COMPILE_OPTIONS property [1]. Regards, Michael [1] http://public.kitware.com/Bug/view.php?id=6493#c13821 _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
