Am Samstag 18 April 2009 03:43:42 schrieb Philip Lowman:
> On Fri, Apr 17, 2009 at 2:23 PM, Hendrik Sattler <p...@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?

PIC code by definition is slower than non-PIC code. As PIC is not needed for 
linking an application with a static library, it is usually not used. You can 
have PIC compiled static libraries when you want to add those to a shared 
library. X did have PIC compiled shared libraries named with a '_pic.a' suffix.

Even libtool compiles twice when creating shared and static libraries.

HS

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to