1 year ago
#382357
Inductiveload
VS Code Intellisense can't find CMake build directory
I have a VS Code CMake project which uses "Kits" to define the CMake builds:
[
{
"name": "Kit name (e.g. cross-compile)",
"cmakeSettings": {
... some settings
}
}
]
In settings.json
the kit is then used to define separate build dirs (e.g. so I can keep cross-compiled builds separate):
{
...
"cmake.buildDirectory": "${workspaceFolder}/build-${buildKit}",
...
}
However, IntelliSense does not understand this in c_cpp_properties.json
:
{
"configurations": [
{
"name": "Foo",
...
"compileCommands": "${workspaceFolder}/build-${command:cmake.buildKit}/compile_commands.json",
}
],
"version": 4
}
nor does it understand back in settings.json
:
{
"C_Cpp.default.compileCommands": "${workspaceFolder}/build-${buildKit}/compile_commands.json"
}
produces
"${workspaceFolder}/build-${buildKit}/compile_commands.json" could not be found. 'includePath' from c_cpp_properties.json in folder 'project' will be used instead.
even though both ${workspaceFolder}
and ${buildKit}
work in the same file for cmake.buildDirectory
.
If I manually hardcode the location, IntelliSense works. If I do nothing (or one of the above), it can't find any include files.
What is the right way to point IntelliSense's compileCommand
setting to the right CMake build directory?
c++
visual-studio-code
cmake
intellisense
0 Answers
Your Answer