target_include_directories fails to work with UNKNOWN imported libraries, requiring longer call to set_target_properties instead.
Calling target_include_directories generates the CMake Error: target_include_directories called with non-compilable target type
add_library(
glfw
UNKNOWN # Use UNKNOWN library type specifier, so that we can accept a variety of library file types (DLL, static)
IMPORTED
)
# Desired syntax doesn't work
target_include_directories(
glfw
INTERFACE
"${CMAKE_BINARY_DIR}/lib/glfw/include"
)
# Required syntax
set_target_properties(
glfw
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES
"${CMAKE_BINARY_DIR}/lib/glfw/include"
)