<div class="gmail_quote">On Tue, Mar 24, 2009 at 12:11 PM, Nadir SOUALEM <span dir="ltr"><<a href="mailto:nadir.soualem@irisa.fr">nadir.soualem@irisa.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="im">Tyler wrote:<br></div>
Not so bad, but it would be very nice to do some things such adding preprocessing on command line calls:<br>
cmake -DPREPROCCESSING_VAR<br>
</blockquote><div><br>You could certainly file a feature request that did something like this but I think it would probably prove too confusing for people.<br><br>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.<br>
<br>Ultimately though build systems usually deal with a fixed number of preprocessor definitions and usually they just add build options for them<br><br>OPTION(USE_FOO "Use foo" ON)<br>if(USE_FOO)<br> add_definitions(-DHAVE_FOO)<br>
find_package(FOO)<br> if(NOT FOO_FOUND)<br> MESSAGE(FATAL_ERROR "You enabled USE_FOO but FOO was not found")<br> endif()<br>endif()<br><br>Obviously if you just want to add a preprocessor definition the code is far simpler<br>
<br>OPTION(ENABLE_BAR "Enable special bar feature" OFF)<br>if(ENABLE_BAR)<br> ADD_DEFINITIONS(-DBAR_ENABLED)<br>endif()<br><br>This has the benefit of documenting your build options as you go along somewhere.<br>
</div></div><br>-- <br>Philip Lowman<br>