microsoft / microsoft/vscode-cmake-tools

Is it by design that the CMake extension correctly evaluates environment variables from presets when using the ${env:<var>} syntax instead of $env{<var>}?

Open
#4,543 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

### Discussed in https://github.com/microsoft/vscode-cmake-tools/discussions/4531

Originally posted by **bhubavenski** August 1, 2025
Today, I accidentally wrote in `CMakePresets.json`

`"toolchainFile": "${env:VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"`
(using the VS Code environment variable expansion syntax) instead of

`"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"`
(which is the CMake environment variable expansion syntax), and both worked the same.

So I’m wondering — is it by design that both syntaxes are supported, or is this considered a bug?

- For me, this should be considered a bug, because using presets with VSC env var expansion syntax syntax is not portable, which goes against the purpose of presets.

Contributor guide

Open the contributing guide

Research direction

Start with the CMakePresets.json handling and environment-variable expansion path in the extension, then compare the ${env:} and $env{} forms. Determine whether accepting both is intentional and whether preset portability is affected; done means the behavior is corrected or documented with regression coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.