[CMake] Compile multiple-sources at a time?

Michael Hertling mhertling at online.de
Fri Jan 20 18:07:59 EST 2012


On 01/19/2012 11:09 PM, Oliver kfsone Smith wrote:
> I realize not every build environment supports the option, but is there 
> a way to get CMake to generate Makefiles which aggregate source files, e.g.
> 
> $ g++ -pipe -o library.a lib1.cpp lib2.cpp lib3.cpp
> $ g++ -pipe -o exeutable file1.cpp file2.cpp file3.cpp library.a
> 
> 
> - Oliver

Aggregating source files in this way fundamentally collides with the
concept of source file properties, a well-established CMake feature.
Thus, it would require a check if the aggregated source files are to
be compiled with exactly the same flags/definitions/etc. If not, one
would need to trade off aggregation against source file properties,
perhaps by use of a variable/property/policy or whatever solution
might suit. Not that trivial, IMO.

Regards,

Michael


More information about the CMake mailing list