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
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,7 @@ Features:
23
23
- Add `cmake.outlineViewType` setting to toggle the Project Outline between a flat list view and the prior hierarchical tree view that shows each CMake project separately. [#3799](https://github.com/microsoft/vscode-cmake-tools/issues/3799)[#4538](https://github.com/microsoft/vscode-cmake-tools/pull/4538)[@ar1m4n](https://github.com/ar1m4n)
24
24
25
25
Improvements:
26
+
- Clarify variable substitution scope in docs for `settings.json` vs generic VS Code `tasks.json`/`launch.json`, including when to use `${command:cmake.*}` and why `${buildKit}`, `${generator}`, and `${config:cmake.configureArgs}` may not expand as expected in tasks. [#4010](https://github.com/microsoft/vscode-cmake-tools/issues/4010)
26
27
- Improve CMake syntax highlighting: extend variable recognition with compiler/toolchain families and add scoped property command colorization for `set_property`, `get_property`, `set_target_properties`, and related commands. [#4527](https://github.com/microsoft/vscode-cmake-tools/pull/4527)[@pboettch](https://github.com/pboettch)
27
28
- Run tests sequentially in alphabetical order (matching the Test Explorer display order) when `cmake.ctest.allowParallelJobs` is disabled. [#4829](https://github.com/microsoft/vscode-cmake-tools/issues/4829)
28
29
- Document how to configure `cmake.debugConfig.visualizerFile` to use custom Natvis files with quick debugging, without requiring a `launch.json`. [#4616](https://github.com/microsoft/vscode-cmake-tools/issues/4616)
Copy file name to clipboardExpand all lines: docs/cmake-settings.md
+19-2Lines changed: 19 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,7 +104,22 @@ Options that support substitution, in the table below, allow variable references
104
104
105
105
## Variable substitution
106
106
107
-
Some settings support the replacement of special values in their string value by using a `${variable}` syntax. The following built-in variables are expanded:
107
+
Some settings support the replacement of special values in their string value by using a `${variable}` syntax.
108
+
109
+
### Where substitution works
110
+
111
+
Use this quick rule to avoid confusion:
112
+
113
+
- CMake Tools `${...}` variables in this section (for example `${buildKit}` and `${generator}`) are expanded only when CMake Tools reads supported `cmake.*` settings from `settings.json`.
114
+
- Generic VS Code `tasks.json` and `launch.json` fields are resolved by VS Code, not by CMake Tools. In those fields, use VS Code variables (for example `${workspaceFolder}`) or command substitutions such as `${command:cmake.buildKit}`.
115
+
-`${config:cmake.*}` in `tasks.json`/`launch.json` returns the raw setting value. It does not apply a second CMake Tools substitution pass.
116
+
117
+
Example:
118
+
119
+
- In a shell task command, `${buildKit}` and `${generator}` are not expanded.
120
+
- In a shell task command, `${command:cmake.buildKit}` is expanded.
121
+
122
+
The following built-in variables are expanded in supported `cmake.*` settings only. None of these are expanded in generic VS Code shell or process task commands. Use the `${command:cmake.*}` forms listed under [Command substitution](#command-substitution) for those contexts.
108
123
109
124
| Variable | Expansion |
110
125
|---------|---------|
@@ -136,7 +151,9 @@ Variant options are expanded using the `${variant:VARIANTNAME}` syntax, where th
136
151
137
152
### Command substitution
138
153
139
-
CMake Tools can expand VS Code commands. For example, you can expand the path to the launch target by using the syntax `${command:cmake.launchTargetPath}`
154
+
CMake Tools can expand VS Code commands. For example, you can expand the path to the launch target by using the syntax `${command:cmake.launchTargetPath}`.
155
+
156
+
This form is the recommended way to get CMake Tools values in generic `tasks.json` or `launch.json` fields.
140
157
141
158
Be careful with long-running commands because it isn't specified when, or how many times, CMake Tools will execute a command for a given expansion.
Copy file name to clipboardExpand all lines: docs/tasks.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,18 @@ You can create a configure task from the VS Code command pallette by running the
3
3
4
4

5
5
6
+
## Variable substitution in `tasks.json`
7
+
8
+
When authoring generic VS Code shell/process tasks, `${buildKit}` and `${generator}` are not expanded because those are CMake Tools setting substitutions, not VS Code task variables.
9
+
10
+
Use command substitutions in `tasks.json` instead:
11
+
12
+
-`${command:cmake.buildKit}` for the active kit name.
13
+
-`${command:cmake.buildType}` for the active build type.
14
+
-`${command:cmake.tasksBuildCommand}` for a full CMake build command.
15
+
16
+
If you use `${config:cmake.configureArgs}` in `tasks.json`, VS Code returns the configured value as-is. CMake Tools substitution is not applied again in that context.
17
+
6
18
By selecting "CMake: configure" template, if you are not using presets, this task will be generated in `tasks.json` file:
0 commit comments