List included directories of a target with CMake
Published in Cmake
When debugging a CMake build file it is often useful to print out all the directories included by a target. The following snippet does just that. Simply replace ${target_name} and run cmake to see the list of included files.
get_property(includes
TARGET ${target_name}
PROPERTY INCLUDE_DIRECTORIES
)
message(STATUS "Included directories for target ${target_name}")
for (dir in ${includes})
message(STATUS " - ${dir}")
endfor()