[CMake] Listing all the include directories

Saad Khattak saadrustam at gmail.com
Mon Mar 26 21:45:55 EDT 2018


Hi,

I have many libraries and packages that are being linked using
target_link_libraries(...) where CMake takes care of the include
directories. There are cases where I get compile errors because I don't
know the exact include directories.

I thought perhaps I could get the include directories of my target by doing
the following:

get_target_property(INCLUDE_DIRS MyExeThatLinksToManyLibs
INCLUDE_DIRECTORIES)
message(STATUS ${INCLUDE_DIRS}) # hoped that this would print all the
include directories

Unfortunately, that did not work as expected. It was missing directories
that I know are added to the include directories of the target (because the
compiler is able to find the headers properly).

Apart from sifting through the compile commands, is there a nice way to
debug the include directories of a target?

Thank you,
Saad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180327/504242ff/attachment.html>


More information about the CMake mailing list