[CMake] Running a C source file through the pre-processor

Magnus Therning magnus at therning.org
Sun Nov 15 06:00:25 EST 2015


I have a tool that, given a C source file, spits out some linker flags
that's necessary to link the file into the final target.  Now the C
source file has grown rather large and I'd like to split some of it into
a header file (those things are also useful in other files to reducing
duplication of code is another reason to do this).  This however means
that it's not enough to pass the C source file through the tool, I need
to pass the pre-processed source to the tool!

The question is then if I can do this easily in some way?

I was thinking of doing it manually so to speak, but then I quickly ran
into the problem of finding the effective CFLAGS used for a
source/target.

/M

-- 
Magnus Therning                      OpenPGP: 0xAB4DFBA4 
email: magnus at therning.org   jabber: magnus at therning.org
twitter: magthe               http://therning.org/magnus

Finagle's Sixth Law:
Don't believe in miracles -- rely on them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151115/3d67a5d3/attachment.sig>


More information about the CMake mailing list