In this snippet:
cmake_minimum_required(VERSION 3.0)
project(hello LANGUAGES C VERSION 0.0.1)
add_library(a INTERFACE)
target_include_directories(a INTERFACE /usr/local/include)
add_executable(b main.c)
target_link_libraries(b PUBLIC a)
get_target_property(dirs b INCLUDE_DIRECTORIES)
message(STATUS "dirs: ${dirs}")
CMake will print:
-- dirs: dirs-NOTFOUND
I want all include directories of a target, but apparently those added via target_link_libraries
get ignored somehow. How can I obtain all include directories of a target?