[CMake] help needed with target_link_libraries and INTERFACE_INCLUDE_DIRECTORIES

Guy McArthur guymac at gmail.com
Thu Aug 1 14:35:24 EDT 2019


I am at my wit's end after 3 days struggling with this problem.

I export a package with several targets. Those targets are in
subdirectories (not sure if that matters). The exported config uses a
namespace. In the generated file xyz-config.cmake, I see the following:

# Create imported target xyz::ABC
add_library(xyz::ABC SHARED IMPORTED)

set_target_properties(xyz::ABC  PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "C:/Users/myself/source/repos/xyz"
  INTERFACE_LINK_LIBRARIES "xyz::Strings;xyz::Utility"
)

And that all looks fine. Now, in a project that depends on xyz::ABC I use
find_package (which seems to work fine) and target_link_libraries(libTarget
xyz::ABC other::Something++).

However, the build process never emits the -I include statement for
xyz::ABC, though it does for other::Something++. This is on MSVC17 btw.

Please help, I have tried everything I can think of.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190801/25217e27/attachment.html>


More information about the CMake mailing list