This is not about Visual Studio Code. It’s not about launch.json
. This question is about Visual Studio and its launch.vs.json
file.
In VS 2022’s launch.vs.json
file, in a custom debug target, how can I reference the current CMake build type? I need something like this:
{
"version": "0.2.1",
"defaults": {},
"configurations": [
{
"type": "default",
"project": "CMakeLists.txt",
"projectTarget": "MyProgram.exe (app\MyProgram\MyProgram.exe)",
"name": "MyProgram.exe (app\MyProgram\MyProgram.exe)",
"environment": [
{
"name": "PATH",
"value": "D:\my-dlls-for-build-type-${cmake.buildType}"
}
]
}
]
}
But ${cmake.buildType}
is not recognized here. I get this error: Var:${cmake.buildType} failed evaluation
.
2
Answers
Take a look of this:
Reference keys in CMakeSettings.json
From the official document:
Is this what you want?
Use
${cmake.configurationType}
.