Re: [CMake] Single library with both shared and static binaries

2019-09-26 Thread J Decker
I ended up using external_project() because unless you also copy the source files, each source file each only gets one set of flags... so if you have different compile options (the config file I suppose) the sources will only build with one or the other. If you copy all of the sources to the CMAKE

Re: [CMake] Single library with both shared and static binaries

2019-09-26 Thread Avraham Shukron
There is no hard requirement for shipping both static and shared. With the back against the wall I could get away with SHARED only, since it is the most common way the library will be consumed. I wanted to also distribute a static version just for those who want a single, self-contained executable.

Re: [CMake] Single library with both shared and static binaries

2019-09-26 Thread Juan Sanchez
Here is an example where two libraries are created from object files that have only been compiled once: ADD_LIBRARY(symdiff_objects OBJECT ${CXX_SRCS} ${MC_SRCS}) set_property(TARGET symdiff_objects PROPERTY POSITION_INDEPENDENT_CODE ON) ADD_LIBRARY(symdiff_dynamic STATIC $) ADD_LIBRARY(symdiff SH

Re: [CMake] Single library with both shared and static binaries

2019-09-26 Thread Simon Richter
Hi, On Tue, Sep 24, 2019 at 11:41:54PM +0300, Avraham Shukron wrote: > I have a library which I want to distribute in both shared object and > static library forms. Is that a requirement for your project, or a requirement for the system integrator? With my Debian Developer hat on, I'm always gr

Re: [CMake] Single library with both shared and static binaries

2019-09-25 Thread Kyle Edwards via CMake
On Tue, 2019-09-24 at 23:41 +0300, Avraham Shukron wrote: > Hi! > > I have a library which I want to distribute in both shared object and > static library forms. > Is there a modern way to do it without creating two completely > separate library targets? > Since I want to be a good CMake citizen I

[CMake] Single library with both shared and static binaries

2019-09-24 Thread Avraham Shukron
Hi! I have a library which I want to distribute in both shared object and static library forms. Is there a modern way to do it without creating two completely separate library targets? Since I want to be a good CMake citizen I use `target_*` and `set_target_properties` as much as possible, and cre