[CMake] Building a "mega" library after building smaller component libraries?
Alan W. Irwin
irwin at beluga.phys.uvic.ca
Mon Dec 13 21:00:38 EST 2010
On 2010-12-13 18:13-0500 Clifford Yapp wrote:
> Can anyone tell me what the best way is (without a whole lot of
> rebuilding) to take several individual libraries and combine them into
> a single large library?
It appears someone has already pointed you to the (lack of)
convenience library reference for CMake. But beyond that I would
advise you think very carefully about your purpose. Do you want to
build individual libraries or a giant library? There should be no
need for both.
If individual, then there should be no need for the giant one since
any application that previously linked to the giant library could be
linked instead to the subset of individual libraries needed by that
application. If your individual libraries have been factored on some
rational basis, then why would you want to lump those nicely factored
results together into a giant library?
On the other hand, if there is no logical rhyme nor reason to the way
your code has been factored into individual libraries (i.e., they
really are meant to be just grab-bag component parts to the giant
library), then don't bother building the individual libraries at all.
Instead, in each individual subdirectory where source code exists that
would normally be used to build the individual libraries, you can
append a list of full pathnames for the source code to a global
property. At the end of processing all subdirectories, the result
will be a global property containing a list of the full pathnames of
all source files that you can use to build the giant library.
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
More information about the CMake
mailing list