[CMake] target_link_libraries not populating INCLUDE_DIRECTORIES?

Ciccio Pasticcio dodungocorporation at gmail.com
Fri Dec 21 03:29:52 EST 2018


Hi all,

considering the following CMakeLists.txt:

PROJECT(lib_foo)
ADD_LIBRARY(lib_foo SHARED <src>)
TARGET_INCLUDE_DIRECTORIES(PRIVATE private/ PUBLIC inc/)
FIND_PACKAGE(Boost 1.55 REQUIRED COMPONENTS chrono system)
TARGET_LINK_LIBRARIES(lib_foo PRIVATE Boost::chrono Boost::system)
GET_TARGET_PROPERTIES(tinc lib_foo INCLUDE_DIRECTORIES)
MESSAGE(STATUS "Include dirs: ${tinc}")

I would expect a message with my private/ and inc/ paths, plus the one that
comes with the Boost libraries, instead I only get the directories
specified in TARGET_INCLUDE_DIRECTORIES. The manpage of
TARGET_LINK_LIBRARIES says:
PRIVATE and PUBLIC items will populate the INCLUDE_DIRECTORIES
<https://cmake.org/cmake/help/v3.13/prop_tgt/INCLUDE_DIRECTORIES.html#prop_tgt:INCLUDE_DIRECTORIES>
property of <target>.

If I print Boost_INCLUDE_DIR I found the inclusion path.

Am I missing something?

Thanks,
Gabriele
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181221/67c81f0d/attachment.html>


More information about the CMake mailing list