[CMake] compiling single source with different flags

Eric Noulard eric.noulard at gmail.com
Tue Dec 29 15:44:34 EST 2009


2009/12/29 Richard Wackerbarth <richard at nfsnet.org>:
> Not as a "real" solution, but more as a "workaround", you could create a "derived source file" which is just a copy of the source file and then you would have two separate files to be compiled with the appropriate flags.

That's one solution, see below for more information.

> On Dec 29, 2009, at 2:22 PM, Bart wrote:
>
>> Hi,
>>
>> I'm trying to find a way to build a library with two different instances of the same source file.
>> for example I would like to compile foo.c with -DDINT into foo_int.o and with -DDLONG into foo_long.o
>> and have both objects added to the same library libfoo.a
>>
>> I have experimented with custom command to generate the source files (which did not work), and would have still
>> left me with how to compile them with different -D flags.

Same kind of question has been asked on the ML recently,
may be you can re-read the thread
http://www.cmake.org/pipermail/cmake/2009-December/033813.html


-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list