I have a setup where I collect multiple include directories that I want to set as include directories, as in this mock up:
add_library(testlib SHARED "")
set_target_properties(testlib PROPERTIES LINKER_LANGUAGE CXX)
list(APPEND includePath "/some/dir" "/some/other/dir")
target_include_directories(testlib PUBLIC
$<BUILD_INTERFACE:${includePath}>
)
The problem now is the following
get_target_property(debug testlib INTERFACE_INCLUDE_DIRECTORIES)
message("${debug}")
prints
/home/user/test-proj/$<BUILD_INTERFACE:/some/dir;/some/other/dir>
where the absolute path to the project is for some reason prepended to the include directories. This leads to cmake proclaiming, somewhere down the line:
CMake Error in src/hypro/CMakeLists.txt:
Target "testlib" INTERFACE_INCLUDE_DIRECTORIES property contains path:
"/home/user/test-proj/"
which is prefixed in the source directory.
Can I somehow use a list with $<BUILD_INTERFACE>
?