[CMake] Difference between IMPORTED_LINK_DEPENDENT_LIBRARIES and IMPORTED_LINK_INTERFACE_LIBRARIES

James Bigler jamesbigler at gmail.com
Wed Dec 10 18:46:24 EST 2008


On Wed, Dec 10, 2008 at 3:33 PM, Hendrik Sattler <post at hendrik-sattler.de>wrote:

> Am Wednesday 10 December 2008 22:57:09 schrieb James Bigler:
> > I've read the documentation, but it's still not clear to me what the
> > difference between these two property is.
> >
> > Could someone please explain it to me?
>
> Under some circumstances, when linking to a library you also have to link
> with
> all dependent libraries, and sometimes linking to the link-interface
> libraries is sufficient.
> The one is a subset of the other.
>


I have a library which depends on libpng.  If libpng is shared, then I don't
need to know that libpng links agains libz, but if libpng is static, then I
better well know that libpng needs libz so that when I need to eventually
link against my library I will link against libpng and libz.

So using this example, is the following code correct?

 add_library(mylibrary SHARED IMPORTED)

  set_target_properties(mylibrary PROPERTIES
    IMPORTED_LOCATION "${mylibrary_location}"
    IMPORTED_LINK_DEPENDENT_LIBRARIES z
    IMPORTED_LINK_INTERFACE_LIBRARIES png
    )

Thanks,
James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081210/14f2136c/attachment.htm>


More information about the CMake mailing list