[CMake] Transitive linking and static libraries

James Bigler jamesbigler at gmail.com
Wed Oct 16 15:32:37 EDT 2013


This seems to do what I want.

Is there a version of this that works for IMPORTED targets.

There's *IMPORTED_LINK_INTERFACE_LIBRARIES*, but I'm not sure how to make
them private for static libraries.

Thanks,
James


On Wed, Oct 16, 2013 at 12:17 PM, Robert Maynard <robert.maynard at kitware.com
> wrote:

> Have you tried using the LINK_PRIVATE signature to target link libraries?
>
> On Wed, Oct 16, 2013 at 2:05 PM, James Bigler <jamesbigler at gmail.com>
> wrote:
> > Is it possible to stop known static libraries from being carried through
> > shared libraries?
> >
> > add_library(mystatic1 STATIC ...)
> > add_library(mystatic2 STATIC ...)
> > add_library(myshared SHARED ...)
> > target_link_libraries(myshared mystatic1 mystatic2)
> > add_executable(myexe)
> > target_link_libraries(myexe myshared)
> >
> > Once a shared library is created, all the information about what
> libraries
> > are needed should be encoded in the shared library.  In addition if myexe
> > links against only myshared then only the symbols being exported by
> myshared
> > should be visible to myexe.
> >
> > I'm seeing problems where symbols from mystatic1 are being seen by myexe,
> > when myexe should only be seeing symbols from myshared.  This is because
> > CMake links myshared, mystatic1, and mystatic2 to myexe all in the same
> link
> > line.
> >
> > James
> >
> > --
> >
> > Powered by www.kitware.com
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> > http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Kitware offers various services to support the CMake community. For more
> > information on each offering, please visit:
> >
> > CMake Support: http://cmake.org/cmake/help/support.html
> > CMake Consulting: http://cmake.org/cmake/help/consulting.html
> > CMake Training Courses: http://cmake.org/cmake/help/training.html
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20131016/1d7931d1/attachment.htm>


More information about the CMake mailing list