[CMake] Add configuration support to include_directories()

cyril_wobow cyril at wobow.com
Tue Dec 23 12:13:14 EST 2008


Bill Hoffman a écrit :
> Robert Dailey wrote:
>
>> For debug: C:\foo\bar-d
>> For release: C:\foo\bar
>>
>> Note that the text "Debug" or "Release" is not used in the include 
>> path, so simply using CFG_INTDIR would not work I don't think (Unless 
>> I'm missing something again). This is why in CMake I need to do 
>> something like this:
>>
>> if( debug )
>>     include_directories( C:\foo\bar-d )
>> else()
>>     include_directories( C:\foo\bar )
>> endif()
>>
>> Thanks again to everyone for their continued help.
>>
>
> OK, well, since VS supports multiple configurations at VS time, and 
> not CMake time, it is impossible to have the above if statement.   
> There is just no way to know what configuration the user will pick.   
> The user gets to pick a long time after that if statement was executed 
> by CMake.  So, I think you are sort of out of luck right now...   What 
> CMake needs is per configuration include_directories for this to 
> work.   One thing that might work as a work around, is that you could 
> copy the header file via a custom command into your build tree, and 
> then use the CFG_INTDIR approach.
>
> -Bill
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

... or have a config.h like :

#ifdef NDEBUG
#include <bar/x.h>
#else
#include <bar-d/x.h>
#endif

Still, complete support of VS configurations would be so great !!

Cyril


More information about the CMake mailing list