On Tue, Mar 24, 2009 at 12:11 PM, Nadir SOUALEM <[email protected]>wrote:
> Tyler wrote:
> Not so bad, but it would be very nice to do some things such adding
> preprocessing on command line calls:
> cmake -DPREPROCCESSING_VAR
>
You could certainly file a feature request that did something like this but
I think it would probably prove too confusing for people.
You could implement it with a macro provided you are comfortable with some
standard way of converting CMake variables into preprocessor definitions.
Any variables that start with DEF_foo would result in
add_definitions(-Dfoo). The list of variables that exist in the system is
available.
Ultimately though build systems usually deal with a fixed number of
preprocessor definitions and usually they just add build options for them
OPTION(USE_FOO "Use foo" ON)
if(USE_FOO)
add_definitions(-DHAVE_FOO)
find_package(FOO)
if(NOT FOO_FOUND)
MESSAGE(FATAL_ERROR "You enabled USE_FOO but FOO was not found")
endif()
endif()
Obviously if you just want to add a preprocessor definition the code is far
simpler
OPTION(ENABLE_BAR "Enable special bar feature" OFF)
if(ENABLE_BAR)
ADD_DEFINITIONS(-DBAR_ENABLED)
endif()
This has the benefit of documenting your build options as you go along
somewhere.
--
Philip Lowman
_______________________________________________
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