[CMake] exclude a dependency from export

Jack Stalnaker jack.stalnaker at gmail.com
Fri Jan 22 14:20:26 EST 2016


Private doesn't work because the names in A need to be part of the public
interface.

On Fri, Jan 22, 2016 at 11:51 AM, Nicholas Braden <
nicholas11braden at gmail.com> wrote:

> Have you tried using the PRIVATE keyword when linking to A?
>
> https://cmake.org/cmake/help/latest/command/target_link_libraries.html#libraries-for-a-target-and-or-its-dependents
>
> On Fri, Jan 22, 2016 at 9:14 AM, Jack Stalnaker <omnijack at gmail.com>
> wrote:
> > Is there any way to exclude a dependency from an export? If I build a
> static
> > library target "A" but do not wish to install it, and then link that
> target
> > to another target "B" using target_link_libraries(B A), and then attempt
> to
> > export B, I get the error message:
> >
> > install (EXPORT "B" ...) includes target "B" which requires target "A"
> that
> > is not in the export set.
> >
> > I can solve the problem by installing A, but there is no need to. It is a
> > temporary target that is statically linked. I just need to export for
> > creating a package config file, so there's no need for the package
> config to
> > ever need to worry about statically linked libraries.
> >
> > Is there a workaround for this?
> >
> > Long story short, I am trying to replicate convenience libraries from
> > autotools. I'm having a hell of time doing it. I can use lists of
> sources,
> > but that requires passing around global variables that include the
> sources
> > and others that include the required libraries. This is far messier and
> far
> > less convenient. I've tried object libraries, and while they eliminate
> the
> > global source variables and prevent rebuilding things, they fail when the
> > source is nested, and you want to build a "super library" from smaller
> > object libraries, which I believe is a fairly common working pattern.
> > Building a static library that is never installed works really well ...
> > until I go to create a package config file. Then this export fails.
> >
> > Thanks,
> > --Jack
> >
> > --
> >
> > 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://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160122/20105fb6/attachment.html>


More information about the CMake mailing list