[CMake] linking static libs into shared libs on Linux

Dan Kegel dank at kegel.com
Tue Jul 7 17:58:27 EDT 2015


On Tue, Jul 7, 2015 at 2:25 PM, Steve Borho <steve at borho.org> wrote:
> We're already adding -fPIC to the compile flags for the two object
> libraries. This way one set of objects can be used to output the shared
> library and the static library. So the C++ files are already compiled
> with -fPIC. It is only a problem when we need to link a static library
> from one build into the shared library of another build.  The static
> library itself no longer supports PIC.

Really?  I didn't think ar was in the habit of modifying machine code like that.

At this point maybe the thing to do is make a toy example that reproduces
the problem.   (Ideally something truly stipped down, like
https://github.com/dankegel/winezeug/tree/master/cmake_examples/ex7 )
- Dan


More information about the CMake mailing list