paths in generator expression are converted abnormally in target_include_directories
CMake version: 3.14.5
Create a project at /Users/daquexian/repos/temp, and use the following minimal CMakeLists.txt:
add_library(test test.cpp)
target_include_directories(test PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/include>)
The include paths shown in compile_commands.json are
-I/Users/daquexian/repos/temp/Users/daquexian/repos/temp -I/Users/daquexian/repos/temp/include
. It looks like the first path is converted to "absolute path" abnormally.
However, if the CMakeLists.txt is changed to
add_library(test test.cpp)
target_include_directories(test PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> <BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
The include paths shown in compile_commands.json are currently the right ones: -I/Users/daquexian/repos/temp -I/Users/daquexian/repos/temp/include