You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I like to have the global build directory set to "cmake.buildDirectory": "${workspaceFolder}/build/${buildType}".
for release or releaseStatic this gets expanded to: ${workspaceFolder}/build/Release.
This should be expected as they both specify "buildType": "Release".
When I want to run programs built I use this in my launch.json: "program": "${workspaceFolder}/build/${command:cmake.buildType}/bin/a.out.
When release config is selected this gets expanded to: "program": "${workspaceFolder}/build/Release/bin/a.out.
However when releaseStatic is selected this is getting expanded to: "program": "${workspaceFolder}/build/Release With Static/bin/a.out.
Obviously I could just configre cmake to set the buildDirectory to: "${workspaceFolder}/build/${command:cmake.buildType}".
But that is not an ideal solution.
What should happen is ${command:cmake.buildType} expands to the same string as ${buildType}, which when using variants should return what the specific variant declares as buildType.
If needs must another variable could be declared that corresponds to a variants 'short' name (Release With Static in this example)
Operating System: Ubuntu 20.04
CMake Version: 3.7.3
VSCode Version: 1.47.0
CMake Tools Extension Version: 1.4.1
Compiler/Toolchain: clang-10.0.0
The text was updated successfully, but these errors were encountered:
Thanks for reporting this. There's a minor complication with the status bar text when fixing the command to do the right thing (it expects the "short" text), but it shouldn't be too bad to rework it.
I have a fix for this out for PR. It was actually less of a change than I thought it would be. I decided to rename the variables with the inconsistent data in them to avoid this sort of situation in the future.
Substitution of
${buildType}
differs from${command:cmake.buildType}
Take this cmake_variants.json (contrived for simplicity)
I like to have the global build directory set to
"cmake.buildDirectory": "${workspaceFolder}/build/${buildType}"
.for
release
orreleaseStatic
this gets expanded to:${workspaceFolder}/build/Release
.This should be expected as they both specify
"buildType": "Release"
.When I want to run programs built I use this in my launch.json:
"program": "${workspaceFolder}/build/${command:cmake.buildType}/bin/a.out
.When
release
config is selected this gets expanded to:"program": "${workspaceFolder}/build/Release/bin/a.out
.However when
releaseStatic
is selected this is getting expanded to:"program": "${workspaceFolder}/build/Release With Static/bin/a.out
.Obviously I could just configre cmake to set the buildDirectory to:
"${workspaceFolder}/build/${command:cmake.buildType}"
.But that is not an ideal solution.
What should happen is
${command:cmake.buildType}
expands to the same string as${buildType}
, which when using variants should return what the specific variant declares asbuildType
.If needs must another variable could be declared that corresponds to a variants 'short' name (
Release With Static
in this example)The text was updated successfully, but these errors were encountered: