[CMake] Compiling static and shared library only once (wiki seems to have an error)

Philip Lowman philip at yhbt.com
Fri Apr 17 21:43:42 EDT 2009


On Fri, Apr 17, 2009 at 2:23 PM, Hendrik Sattler <post at hendrik-sattler.de>wrote:

> Am Freitag 17 April 2009 20:13:40 schrieb Shaun Cummins:
> > Thanks, that solves one problem. I still haven't found a way to create
> > both shared and static libraries by only compiling the source code
> > once (on Linux). I can generate both types of libraries in one make
> > command but each source file is compiled twice.
> >
> > Does anyone know how to do this?
>
> You cannot as one has is compile as PIC and one as non-PIC.


I've done this before in my pre-cmake days on Linux and didn't run into any
problems.  Obviously Windows is out in terms of reusing static object files
as shared libraries.  What about MacOSX and older Unix systems?  Can you
reuse code compiled with -fPIC in static libraries without any problems?

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090417/a902a7e6/attachment.htm>


More information about the CMake mailing list