[CMake] Combined Static Libraries

Alan W. Irwin irwin at beluga.phys.uvic.ca
Sat Aug 5 19:21:00 EDT 2006


On 2006-08-05 13:01-0500 Daniel J. Hilferty wrote:

> I am a programmer for the open source graphics library: G3D.  I have been 
> evaluating CMake as a replacement for our current build system, but I have 
> run into some trouble creating the release libraries.   G3D's release 
> libraries include a combination of our own object files and the libraries 
> zlib, IJG and png.  For convenience, we link these libraries together in our 
> release versions.   I have been unable to figure out how to do this with 
> CMake.  I figured that the line:
>
> TARGET_LINK_LIBRARIES (G3D ${ZLIB_LIBRARY} ${PNG_LIBRARY} ${JPEG_LIBRARY})
>
> would link the libraries, but it does not automatically link with zlib, IJG 
> and png.  The resulting libraries are useless unless the user explicitly 
> links with those libraries.
> Does anyone know how to create these combination libraries with CMake?

I only have a month of experience with CMake but that experience (PLplot
uses libgd which links to the png, jpeg, and zlib libraries) is such an
approach works fine when building shared libraries, but I haven't tried it
yet when building static libraries. Have you dumped out exactly what
${ZLIB_LIBRARY} etc. variable values are for your case?

More details would be helpful as well.  Please post the values of the
above variables for your platform.  Also, what version of cmake, what
platform, what is the exact link command you are getting in the build tree,
and in the install tree? (-DCMAKE_VERBOSE_MAKEFILE=ON).  Also, ldd output
(if you are developing on Linux) on one of the libraries where you are
unhappy with the linking would be useful.

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 Yorick front-end to PLplot (yplot.sf.net); 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