List included directories of a target with 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()

Revision History

2026-01 Migrate to date based urls

Instead of grouping articles by category, we just store them in date order in the content folder.

2025-10 Fix typos and spaces
2017-05 Added some tips to existing articles
2017-04 Add `cmake-list-included-dirs`