[CMake] Difference between IMPORTED_LINK_DEPENDENT_LIBRARIES and IMPORTED_LINK_INTERFACE_LIBRARIES
Hendrik Sattler
post at hendrik-sattler.de
Thu Dec 11 01:28:11 EST 2008
Am Thursday 11 December 2008 00:46:24 schrieb James Bigler:
> 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
> )
Most likely, your library doesn't export and interfaces of libpng, thus
set_target_properties(mylibrary PROPERTIES
IMPORTED_LOCATION "${mylibrary_location}"
IMPORTED_LINK_DEPENDENT_LIBRARIES "png;z"
IMPORTED_LINK_INTERFACE_LIBRARIES ""
)
This assumes that mylibrary is a shared library.
HS
More information about the CMake
mailing list