microsoft / microsoft/vscode-cmake-tools
launch.json file: cmake.configureEnvironment cannot be used for "environment"
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.7k
- Forks
- 546
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 32
Description
### Brief Issue Summary
With previous vscode versions, in launch.json we could add `"env": "${command:cmake.configureEnvironment}"`
Current vscode versions replaced `"env"` by` "environment"`, but `${command:cmake.configureEnvironment}` still expands to a format compatible with only `"env" `and not `"environment"`.
This means we cannot automatically use cmake presets configure/build environment to run an executable :-(
launh.json file to reproduce:
```
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Essai",
"type": "cppdbg",
"request": "launch",
"program": "${command:cmake.launchTargetPath}",
"args": [],
"stopAtEntry": false,
"cwd": "${fileDirname}",
"environment": "${command:cmake.configureEnvironment}",
"externalConsole": false,
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
```
In this example, `"environment": "${command:cmake.configureEnvironment}"` is not recognized.
### CMake Tools Diagnostics
```shell
{
"os": "win32",
"vscodeVersion": "1.96.2",
"cmtVersion": "1.19.52",
"configurations": [
{
"folder": "c:\\Users\\Flo\\Documents\\Dev\\Project-Template",
"cmakeVersion": "3.26.3",
"configured": true,
"generator": "Ninja",
"usesPresets": true,
"compilers": {
"C": "C:/Qt/Tools/mingw1120_64/bin/gcc.exe",
"CXX": "C:/Qt/Tools/mingw1120_64/bin/g++.exe"
}
}
],
"cpptoolsIntegration": {
"isReady": true,
"hasCodeModel": true,
"activeBuildType": "Release",
"buildTypesSeen": [
"Release"
],
"requests": [],
"responses": [],
"partialMatches": [],
"targetCount": 35,
"executablesCount": 1,
"librariesCount": 4,
"targets": []
},
"settings": [
{
"communicationMode": "automatic",
"useCMakePresets": "auto",
"configureOnOpen": true
}
]
}
```
### Debug Log
```shell
```
### Additional Information
_No response_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the supplied launch.json and the ${command:cmake.configureEnvironment} entry point using CMake presets. Trace how that command's result is passed to the VS Code "environment" property rather than "env". Done means the configure/build environment is accepted and the configured executable launches with it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, typescript, vscode
- Domain
- build-system, developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100