VS: SYSTEM include directories break some VS 2019 Intellisense features
I stumbled upon a very strange problem. It seems that for some reason in CMake 3.24.x (I tried both 3.24.0 and 3.24.2), somehow the include directories are not populated for (at least) imported targets.
This is the same project, generated for VS2019, once with CMake 3.23.0 and 3.24.2. Note that Boost and nhlohmann_json include directories are missing. Linkage requirements seem to be populated just fine.
find_package(nlohmann_json REQUIRED)
find_package(Boost REQUIRED)
add_library(foxglove_websocket)
add_library(foxglove::foxglove_websocket ALIAS foxglove_websocket)
target_sources(foxglove_websocket
...
)
target_include_directories(foxglove_websocket
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_link_libraries(foxglove_websocket
PUBLIC
nlohmann_json::nlohmann_json
Boost::boost
)
target_compile_features(foxglove_websocket PUBLIC cxx_std_17)
Everything good with CMake 3.23.0:
Includes missing with CMake 3.24.2:
I though I was going crazy why my includes could not be found, but with 3.23.0 everything works well. Just a bit confused that this has not yet been reported, so it might not go wrong in all cases.
Any idea how to make a small reproducible sample?