Hi All,

Say I have a CMakeLists.txt that  does

add_definitions(-DFOO=1)
add_subdirectory(bar)

and in bar the CMakeLists.txt does

add_definitions(-DFOO=2)

The intention being that the code in the subdirectory needs the different
definition of FOO. Is there a straightforward way to temporarily override
the -DFOO? That is, when we go back up to the parent that -DFOO=1 now has
effect? My naive attempt above means that -DFOO=1 -DFOO=2 ends up in the
compiler arguments which causes things to break (the compiler doesn't like
FOO being redefined like that).

Any hints?

thanks
b.
_______________________________________________
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