[CMake] Adding support of #include MACRO(foo) in Cmake

Guillaume Damiand damiand at sic.univ-poitiers.fr
Tue Mar 25 06:31:45 EDT 2008


Hi,

I have a problem with cmake dependencies which do not support #include
with a macro.

This is really a problem for me, because I have a lot of inline files,
and when I compile in mode debug, there are many files that are
re-compile, and this is not necessary (for example, for one of my
project, 57 files are re-compiled instead of 1).


Thus, I have added a functionally in cmake to be able to solve
(partially?) this problem.

I have added a new command : 

	INCLUDE_MACRO(macro_name [transfo_rule])

which allows to scan lines such that #include macro_name(file).
transfo_rule allows to modify (eventually) the filename. I have (for the
moment) only one basic transformation rule : a string with a % which is
replaced by the filename.

We can of course add several macros, by using several times the new
command.


This works perfectly for me, and speed up my compilation times. In fact,
I define different macros, depending on the CMAKE_BUILD_TYPE.


I hope this new functionality can be added in the next release of
cmake ? 

May I have a contact with someone of cmake team to give my sources, and
explain modifications ?


Moreover, tmy first solution can be improved, for example by adding more
complex transform rules, or other things ?

I hope this can help.

Chears

Guillaume Damiand



More information about the CMake mailing list