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
_______________________________________________
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

Reply via email to