[CMake] C/C++ projects: Can cmake generate a '-include file' option for the compiler?

Martin Weber fifteenknots505 at gmail.com
Fri Mar 20 16:53:24 EDT 2015


Hi,

is there a way in the cmakelists syntax to generate a build script 
(make/ninja/...) that will invoke the C/C++ compiler with an '-include file' 
or '-include macros' option?
>From the GNU cpp man page:

-include file
           Process file as if "#include "file"" appeared as the first line of 
the primary source file. ...
-imacros file
           Exactly like -include, except that ...

I do not really believe these options make any sense when using cmake (they 
seem to be GNU cc specific), but I am the author of an eclipse plugin that 
integrates cmake with eclipse CDT and have to parse the build output in order 
to feed the CDT indexer with macro definitions and include paths.

I am asking, because I want to avoid writing parsers that detect the above 
compiler options.

Are there any script generators that produce compiler invocation with the 
above otions? Or tool chains?

TIA,
	Martin
 
-- 
Quidquid latine dictum sit, altum viditur.


More information about the CMake mailing list