[CMake] Include directories of IMPORTED libraries not propagating

Saad Khattak saadrustam at gmail.com
Fri Dec 22 10:17:01 EST 2017


Hi,

I have the following setup:

ImportedLib (sets location of library files and public include directories)
LibA             (publicly includes ImporteLib with
target_link_libraries(...))
Exe              (finds LibA and links against it)

Where ImportedLib uses "set_target_properties(ImportedLib PROPERTIES
IMPORTED_LOCATION_DEBUG ... INTERFACE_INCLUDE_DIRECTORIES ...)" to set its
include directories and prebuilt libraries for linking.

LibA uses "target_link_libraries(LibA PUBLIC ImportedLib)". CMake correctly
generates the project such that LibA now has the include directories of the
ImportedLib. LibA then uses the "install(...)" feature so that "Exe" can
find LibA.

With Exe, I find LibA using "find_package(LibA REQUIRED)" and then
"target_link_libraries(Exe LibA)". Exe inherits LibA's include directories
and links against it. Exe is also able to link against ImportedLib.
However, what Exe does not inherit is the public include directories
specified by ImportedLib. This seems like a bug because it is able to know
about and is able to link against ImportLib prebuilt library files.

If it's not a bug, how do I make sure ImportedLib include directories are
propagated properly?

Regards,
Saad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cmake.org/pipermail/cmake/attachments/20171222/2118eb33/attachment.html>


More information about the CMake mailing list