[CMake] scope of set_source_files_properties?

Verweij, Arjen VerweijA at tass-safe.com
Tue Mar 23 12:47:44 EDT 2010


Hi,

>-----Original Message-----
>From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf
>Of Simmons, Aaron


>All the sources are going into a single *library*.  I could make a bunch
>of static libraries corresponding to each folder, but I'm not sure how
>to subsequently link all them into a single static library.  (It's been
>mentioned elsewhere on this list, but the answer was vague.)

For our Fortran code, we're currently migrating from Makefiles and RCS to SVN and CMake. It is apparent that CMake and static libraries over more than a single source directory don't play nice. Fortunately Michael Wild was nice enough to type it out for the inadvertent cmake user.

Also, we ran into the problem referenced in this thread, where the source flags that were overridden mysteriously disappeared. Sometimes, inside the source (mostly Fortran) are compiler flags differing from "the default" that need to be set, as well as openmp statements. So instead of setting the source flags in the local directory, we're now going to set it from the top level target, and wrap the functionality in a "my_add_library()" that will parse the source list, look for override cmake files, set the overrides for the particular file and THEN add the library. Easy as pie.

>At any rate, it seems like a rather elaborate workaround...

I agree. But linking is really expensive, so I'm seriously considering making a customer version (also for innight testing) and a development version that will use shared objects so you don't have to link a tonne of objects everytime you changed a source file. Previously, we would have source and binaries sit in a shared directory, and the make system would just link the updated object again the already existing binary, to keep it fast. Of course this has drawbacks, but I'm looking for something equally fast and I don't think I will achieve it without going to an .so model for the subcomponents.

If only there were a function like add_objects() that would provide you with targets to be used further along the line, eh :) But I guess this usage really is a corner case and not used much.

Regards,
Arjen




More information about the CMake mailing list