Include directories of IMPORTED libraries not propagating

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Include directories of IMPORTED libraries not propagating

Saad Khattak

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?



Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: