[CMake] how to add capability to generate preprocessed and
not-yet-compiled files ?
Alexander Neundorf
a.neundorf-work at gmx.net
Fri Jul 14 02:47:36 EDT 2006
-------- Original-Nachricht --------
Von: Brad King <brad.king at kitware.com>
> Alexander Neundorf wrote:
> > Hi,
> >
> > it would be nice if it would be possible to have for each object file
> also a target which only preprocesses the file and one which
> preprocesses and compiles, but not assembles the file (so that you get
> the assembler code).
> >
> > Is there a way to do this with macros ?
> > I almost think this would have to be done in cmake itself. Probably
> somewhere where the object rules are created additionally for each object the
> same rule but with "-E" instead of "-c" would have to be created. It
> wouldn't be required to be executed on all, just on direct invocation:
> > make foo.o/pre
> > make foo.o/as
> >
> >
> > What do you think about this ?
> > Would you accept a patch ?
>
> Look in Modules/CMakeCInformation.cmake for the variable
> CMAKE_C_COMPILE_OBJECT. Other modules in the Platform directory set it
> also. Just duplicate the variable with one called
> CMAKE_C_PREPROCESS_OBJECT and then setup
> cmLocalUnixMakefileGenerator3.cxx to create rules with ".E" extensions
> instead of ".o". You should be able to locate places that lookup
> *_COMPILE_OBJECT vars. See Modules/CMakeCXXInformation.cmake for the
> C++ version.
Ok, yesterday I had a look at it and managed to get the rules for preprocessed files produced.
It ended up in cmMakefileTargetGenerator::WriteObjectBuildFile().
Problem: the rule was created in builddir/CMakeFiles/target.dir/build.make, but not in builddir/Makefile, so I had to enter "make -f CMakeFiles/target.dir/build.make main.o.E".
What do I have to do to have this rule also appear in the Makefile in the build dir ?
Bye
Alex
--
Echte DSL-Flatrate dauerhaft für 0,- Euro*!
"Feel free" mit GMX DSL! http://www.gmx.net/de/go/dsl
More information about the CMake
mailing list