I'm using Visual Studio 2019 16.7.2 to open a CMake project that uses header files and libs located inside an absolute C:\dependencies path. However, that path is never directly referenced in CMakeLists.txt, and is only used in a separate build script that ships with the project and executes successfully. This means that when working on the project within VS, IntelliSense fails to recognize the included headers from C:\dependencies\lib[A,B,...], e.g. #include <libA/header.h> will not find the header for autocomplete and similar features.
I am not supposed to modify the CMakeLists.txt directly. Instead, I would like to reference headers from C:\dependencies base path in an unversioned CMakeSettings.json file which would hopefully fix the IntelliSense issue. Here's what I tried but it didn't work:
- adding an
include_directoriesvariable:
"variables": [ { "name": "include_directories", "value": "C:/dependencies/libA/include C:/dependencies/libB/include" "type": "PATH" }]
- adding a CMAKE_CXX_FLAGS variable:
"variables": [ { "name": "CMAKE_CXX_FLAGS", "value": "-I C:/dependencies/libA/include C:/dependencies/libB/include" }]
The path strings themselves are not an issue, e.g. "C:\dependencies\libA\include" contains a directory libA with the referenced headers.
Any ideas on how to get IntelliSense to recognize the headers successfully?