cmake_minimum_required(VERSION 3.14) enable_language(C) add_library(foo1 STATIC empty.c) target_include_directories(foo1 PUBLIC include) target_link_libraries(foo1 PRIVATE foo2 foo3 foo4) add_library(foo2 STATIC empty.c) target_include_directories(foo2 PUBLIC $) add_library(foo3 STATIC empty.c) target_include_directories(foo3 PUBLIC $) add_library(foo4 STATIC empty.c) target_include_directories(foo4 PUBLIC $) add_library (foo5 SHARED empty.c) set_property(TARGET foo5 PROPERTY INCLUDE_DIRECTORIES "$<$:/include/CUDA>" "$<$:/include/Fortran>") set_property(TARGET foo5 PROPERTY INTERFACE_INCLUDE_DIRECTORIES "$<$:/include/CUDA>" "$<$:/include/Fortran>") set_property(TARGET foo5 PROPERTY CUSTOM ";;") # Evaluate a genex that looks up INCLUDE_DIRECTORIES on multiple targets. file(GENERATE OUTPUT out.txt CONTENT "INCLUDES1:$\nINCLUDES2:>$<\nINCLUDES3:>$<\nCUSTOM:>$<\n")