vscode-cmake-tools
vscode-cmake-tools copied to clipboard
Run and `Debug` and `Run without debugging` didn't respect `environment` from build preset
Brief Issue Summary
I have a library dependency which has same dll names for debug and release builds, but has different folder. So I need to have build configuration - dependent item in PATH.
It looks like it's not possible in v1.11.26.
Currently I have launch.json with ${input:configuration} so user can select which version to debug/run.
Native solution is to add it to CMakePresets.json. It supports environment for configuration and build presets. But looks like plugin doesn't respect environment from build preset, only from configuration.
CMakePresets.json
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 21,
"patch": 0
},
"configurePresets": [
{
"name": "default"
"environemnt": {"var1": "value1", "var2": "$env{configuration}"}
}
],
"buildPresets": [
{
"name": "Debug",
"configurePreset": "default",
"configuration": "Debug",
"environemnt": {"configuration": "Debug"}
},
{
"name": "Release",
"configurePreset": "default",
"configuration": "Realase"
"environemnt": {"configuration": "Release"}
}
]
With that file I'd expect to have
var1=value1var2=Debugorvar2=Releaseconfiguration=Debugorconfiguration=Release
But when I start debug or just run it using cmake plugin I have only
var1=value1
CMake Tools Diagnostics
No response
Debug Log
No response
Additional Information
No response
What exactly are you trying to do here? It looks like you are trying to use a multi-config generator, In order to have two different values, you will have to define two different configure presets, because a multi-config generator will generate all the configurations at once. Because configure happens before build, any variable you define on buildpreset, won't be available during configuration.
This issue has been closed automatically because it's labeled as a 'question' and has not had recent activity.