[CMake] transitive linking topics

Rolf Eike Beer eike at sf-mail.de
Thu Nov 24 03:47:03 EST 2011


> On 2011-11-23 10:44+0100 Michael Wild wrote:
>
>> On 11/23/2011 10:25 AM, Alan W. Irwin wrote:
>>> cmake-2.8.6 has the following documentation of the
>>> LINK_INTERFACE_LIBRARIES property for targets:
>>>
>>>   LINK_INTERFACE_LIBRARIES
>>>        List public interface libraries for a shared library or
>>> executable.
>>>
>>>        By default linking to a shared library target transitively links
>>> to
>>>        targets with which the library itself was linked.  For an
>>> executable
>>>        with exports (see the ENABLE_EXPORTS property) no default
>>> transitive
>>>        link dependencies are used.  This property replaces the default
>>>        transitive link dependencies with an explicit list.  When the
>>> target
>>>        is linked into another target the libraries listed (and
>>> recursively
>>>        their link interface libraries) will be provided to the other
>>> target
>>>        also.  If the list is empty then no transitive link dependencies
>>> will
>>>        be incorporated when this target is linked into another target
>>> even if
>>>        the default set is non-empty.  This property is ignored for
>>> STATIC
>>>        libraries.
>>>
>>> I believe the reference to executables above is just plain
>>> wrong/misleading.  For example, the FAQ states that
>>> LINK_INTERFACE_LIBRARIES simply lists "the libraries that should be
>>> transitively included in the link by CMake" with the clear implication
>>> (also confirmed by experiment below) that this target property affects
>>> _everything that links to the target whose property is being set_.
>>> But nothing links to an executable so why are executables mentioned at
>>> all?
>>
>> That's not true. See the ENABLE_EXPORTS target property.
>
> Oops.  You are right.  I had never ever heard of applications
> exporting symbols before.  Live and learn.

You use one every day:

$ /lib/libc.so.6
GNU C Library stable release version 2.11.3 (20110203), by Roland McGrath
et al.
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
[...]

Eike


More information about the CMake mailing list