[CMake] debug/optimized include directories

Michael Wild themiwi at gmail.com
Sun Nov 6 03:27:15 EST 2011


On 11/05/2011 09:59 PM, Michael Hertling wrote:
> On 11/02/2011 05:36 PM, Michael Wild wrote:
>> Thanks ;-)
>>
>> Michael
> 
> Just an additional remark: Instead of generating the proxy headers
> in CMakeLists.txt, i.e. at configuration time, one might also have
> them generated by a custom command, i.e. at build time, which has
> the $<CONFIGURATION> expression available. E.g., one might use a
> CMake script invoked by the custom command via -P with -DCONFIG=
> $<CONFIGURATION>, and within this script, one could do arbitrary
> things based on the CONFIG parameter, i.e. linking/copying real
> headers, generating proxy headers with or without #ifdefs etc.
> In this way, one can gather the entire machinery in the script
> and does not need to do the case differentiation in the header
> itself, triggered via COMPILE_DEFINITIONS_<CONFIG> properties.
> Besides, with the custom command's DEPENDS clause, the actions
> can be set up to re-take place if any prerequisite has changed.
> 
> Regards,
> 
> Michael
> 

Indeed, that would be a more sophisticated way of doing it, but it
requires maintaining a separate CMake script. Some might consider this
to be a drawback, other an advantage as it declutters the CMakeLists.txt
file.


Michael


More information about the CMake mailing list