View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004222CMakeCMakepublic2006-12-16 21:112016-06-10 14:30
ReporterGonzalo Garramuno 
Assigned ToBill Hoffman 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionmoved 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0004222: ADD_LIBRARY should support simultaneous STATIC | SHARED builds
DescriptionCurrently, CMake defaults to have ADD_LIBRARY support either a static or a shared library build.
Unfortunately, these statements/switches are exclusive from each other.

This is somewhat wrong and more limiting than autoconf. ADD_LIBRARY() should support creating both static and shared built libraries, so that the result (on Unix, for example, is):

libZZZ.so
libZZZ.a

Currently, cmake forces you to create two builds for obtaining a similar behavior (and it is problematic for large projects that may need to mix some libraries being created static, some both and some shared).
TagsNo tags attached.
Attached Files

 Relationships
related to 0014539closedKitware Robot Multiple output configurations 
has duplicate 0010216closedBill Hoffman Add a CMake way to create a static and shared library at the same time 
has duplicate 0014979closedStephen Kelly build both static and dynamic with cmake arguments 

  Notes
(0013995)
Daniel Santos (reporter)
2008-10-31 06:43

bump, cmake really needs this
(0014015)
Rolf Eike Beer (developer)
2008-11-03 06:45

I would like to see this, too. But when this goes in we need a way to specify to which version another target links.
(0014283)
Philip Lowman (developer)
2008-12-04 03:07

For those interested this can be worked around with some CMake wrapping macros.

We use a global variable that includes either STATIC, SHARED, or both in a list, and then wrap ADD_EXECUTABLE and ADD_LIBRARY to create targets with "-shared" and "-static" suffixes. Then we wrap TARGET_LINK_LIBRARIES for our own libraries to do the same. The net effect is with a few macros you can create both shared and static simultaneously.

See:
http://www.mail-archive.com/cmake@cmake.org/msg07864.html [^]
(0038504)
Stephen Kelly (developer)
2015-04-13 13:55

CMake might also need to either provide a way to generate multiple IMPORTED targets on export(), or generate IMPORTED targets with multiple LOCATION_FOO properties.
(0041338)
Kitware Robot (administrator)
2016-06-10 14:27

Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.

 Issue History
Date Modified Username Field Change
2008-10-31 06:43 Daniel Santos Note Added: 0013995
2008-11-03 06:45 Rolf Eike Beer Note Added: 0014015
2008-12-04 03:07 Philip Lowman Note Added: 0014283
2013-11-02 10:24 Stephen Kelly Relationship added has duplicate 0010216
2015-04-13 13:53 Stephen Kelly Relationship added has duplicate 0014979
2015-04-13 13:55 Stephen Kelly Note Added: 0038504
2015-04-13 13:55 Stephen Kelly Relationship added related to 0014539
2016-06-10 14:27 Kitware Robot Note Added: 0041338
2016-06-10 14:27 Kitware Robot Status assigned => resolved
2016-06-10 14:27 Kitware Robot Resolution open => moved
2016-06-10 14:30 Kitware Robot Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team