Hello,

is it possible to inherit compiler defines for sub projects in sub directories?

I have a library project which can be configured at compile time using preprocessor defines (cmake option)

option(FOO_OPTION "enable foo" OFF)
option(BAR_OPTION "enable bar" OFF)


if(FOO_OPTION)
    set_target_properties(my_lib PROPERTIES COMPILE_DEFINITIONS "FOO_X" )
elseif(BAR_OPTION)
    set_target_properties(my_lib PROPERTIES COMPILE_DEFINITIONS "FOO_Y")
else()
    set_target_properties(my_lib PROPERTIES COMPILE_DEFINITIONS "OTHER" )
endif()

now, in the sub of this I have unit tests which need to know about this compile defs, hence I have the same if/else again.

Is there an easy way for this?

Thanks,
Olaf
--

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