[cmake-developers] [CMake 0014979]: build both static and dynamic with cmake arguments

Mantis Bug Tracker mantis at public.kitware.com
Tue Jun 17 20:00:41 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://www.cmake.org/Bug/view.php?id=14979 
====================================================================== 
Reported By:                Nico
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   14979
Category:                   (No Category)
Reproducibility:            have not tried
Severity:                   feature
Priority:                   low
Status:                     new
====================================================================== 
Date Submitted:             2014-06-17 20:00 EDT
Last Modified:              2014-06-17 20:00 EDT
====================================================================== 
Summary:                    build both static and dynamic with cmake arguments
Description: 
Right now, to build both the static and the dynamic version of a library, two
`add_library` calls have to be present in the respective CMakeLists.txt file,
e.g.,
```
add_library(MyLib SHARED source1.c source2.c)
add_library(MyLibStatic STATIC source1.c source2.c)
```
To control this from the command line, one has the switch `BUILD_SHARED_LIBS`
which is set to either on or off.

In Debian -- and possibly other distributors too --, you would like to build
*both* shared and dynamic versions of all libraries, and that without modifying
the software sources. The first option (patch the software to contain both
`add_library(... SHARED ...)` and `add_library(... STATIC ...)`) is hence not an
option.

It seems that configuring the software twice, with BUILD_SHARED_LIBS set to ON
and OFF, respectively, is the only option.

Is this what CMake developers would recommend, too, or would there be a smarter
way of handling things?
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-06-17 20:00 Nico           New Issue                                    
======================================================================



More information about the cmake-developers mailing list