[CMake] Combined Static Libraries

speedy speedy at 3d-io.com
Sat Aug 5 20:26:39 EDT 2006


Hello Daniel, Alan,

      you might be in luck if you are using VC++ generator, I had a
      need for a similar feature - patch is in the attachment.

      It simply adds the possibility to pass additional link flags /
      parameters to the linker upon static library build, defined
      overall or per build type (aka. VC++ configuration).

      I plan to do a bit more work on it when need arises, to remove
      cmake's global static library remapping to .exe at link time.
      For now, I'm meta-building only static libs with cmake.

      Usage:
      
ADD_LIBRARY(lib_name STATIC [files_here])

SET_TARGET_PROPERTIES(lib_name PROPERTIES
      LINK_FLAGS_DEBUG "[additional debug lib files/paths here +
      additional linker options if any]"
      LINK_FLAGS_RELEASE "[release lib files/paths here + additional
      linker options if any]")

      Cheers & hope it helps!

      
Sunday, August 6, 2006, 1:31:10 AM, you wrote:

DJH> Alan W. Irwin wrote:
>> 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
>> ________________________
DJH> After reading the FAQ, I found that what I actually wanted to create is
DJH> a convenience library -- which is not yet supported by CMake.  The FAQ
DJH> led me to believe that there is no future plans to support this 
DJH> feature.  Has anyone hear differently?

DJH> Dan
DJH> _______________________________________________
DJH> CMake mailing list
DJH> CMake at cmake.org
DJH> http://www.cmake.org/mailman/listinfo/cmake



-- 
Best regards,
 speedy                            mailto:speedy at 3d-io.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmake-2.4.2-static_library_per_config_addidional_link_flags.diff
Type: application/octet-stream
Size: 777 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20060806/70567265/cmake-2.4.2-static_library_per_config_addidional_link_flags.obj


More information about the CMake mailing list