[CMake] set_target_properties not setting COMPILE_DEFINITIONS?
David Doria
daviddoria at gmail.com
Mon Mar 28 14:23:06 EDT 2011
I have setup a list of definitions:
SET(MAIN_BUILD_DEFINITIONS "${MAIN_BUILD_DEFINITIONS} UNIX;")
SET(MAIN_BUILD_DEFINITIONS "${MAIN_BUILD_DEFINITIONS} PIXEL_DIMENSION=3;")
I display them and apply them to my executable as follows:
add_executable(ImageCompleter ${MainSources})
message("Main build definitions: " ${MAIN_BUILD_DEFINITIONS})
set_target_properties(ImageCompleter PROPERTIES COMPILE_DEFINITIONS
"${MAIN_BUILD_DEFINITIONS}")
The output is:
Main build definitions: UNIX PIXEL_DIMENSION=3
which looks correct (i.e. UNIX was defined)
However, in my code there is:
#if defined(UNIX)
... some code...
#else
#error "Not implemented for this platform!"
#endif
When I build, the error is produced, indicating that UNIX was not defined.
I created a small standalone example and it worked as expected... any
suggestions of what else to check?
Thanks,
David
More information about the CMake
mailing list