[CMake] Difference between IMPORTED_LINK_DEPENDENT_LIBRARIES and IMPORTED_LINK_INTERFACE_LIBRARIES

James Bigler jamesbigler at gmail.com
Thu Dec 11 11:34:14 EST 2008


On Wed, Dec 10, 2008 at 11:28 PM, Hendrik Sattler
<post at hendrik-sattler.de> wrote:
> 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.

Thanks for the information.

So what would an example be that would use IMPORTED_LINK_INTERFACE_LIBRARIES?

James


More information about the CMake mailing list