Skip to content

Commit efe3e93

Browse files
committed
Merge branch 'main' into issue-4404-utility-target-shadowing
2 parents 7de05e1 + a1ceda2 commit efe3e93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+737
-578
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Features:
66

77
- Add an option to specify the launch target for debugging CTest tests. [#4273](https://github.com/microsoft/vscode-cmake-tools/pull/4273)
88
- Add a setting to enable/disable our built-in language services. [#4290](https://github.com/microsoft/vscode-cmake-tools/issues/4290)
9+
- Add an option to group the default build target dropdown using CMake groups [#3953](https://github.com/microsoft/vscode-cmake-tools/pull/3953) [@itzandroidtab](https://github.com/itzandroidtab)
10+
- Add `cmake.exclude` setting that allows users to set folders that they want the CMake Tools extension to ignore. [#4112](https://github.com/microsoft/vscode-cmake-tools/issues/4112)
911

1012
Improvements:
1113

@@ -20,6 +22,7 @@ Bug Fixes:
2022
- Fixes localization for "workspace is" string. [#4374](https://github.com/microsoft/vscode-cmake-tools/issues/4374)
2123
- Make tooltips for selecting Launch/Debug Target. [#4373](https://github.com/microsoft/vscode-cmake-tools/issues/4373)
2224
- Fix bug where unrelated symlinks are read as variant files [#4304](https://github.com/microsoft/vscode-cmake-tools/issues/4304) [@vitorramos](https://github.com/vitorramos).
25+
- Fix evaluation of conditions in presets. [#4425](https://github.com/microsoft/vscode-cmake-tools/issues/4425)
2326
- Fix incorrect IntelliSense configuration when a `UTILITY` has source files. [#4404](https://github.com/microsoft/vscode-cmake-tools/issues/4404)
2427

2528
## 1.20.53

docs/README.md

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,16 @@ CMake Tools is an extension designed to make it easy to work with CMake-based pr
55
If you are new, try the [CMake Tools quick start](https://code.visualstudio.com/docs/cpp/CMake-linux) and see the [frequently asked questions](faq.md).
66

77
[How to](how-to.md)
8+
89
* [Create a new project](how-to.md#create-a-new-project)
910
* [Configure a project](how-to.md#configure-a-project)
1011
* [Build a project](how-to.md#build-a-project)
1112
* [Debug a project](how-to.md#debug-a-project)
1213
* [Pass command-line arguments to the debugger](debug-launch.md#debug-using-a-launchjson-file)
1314
* [Set up include paths for C++ IntelliSense](how-to.md#set-up-include-paths-for-c-intellisense)
1415

15-
[Kits](kits.md)
16-
* [How kits are found and defined](kits.md#how-kits-are-found-and-defined)
17-
* [Kit options](kits.md#kit-options)
18-
19-
[Configure](configure.md)
20-
* [CMake configuration process overview](configure.md#cmake-configuration-process-overview)
21-
* [The CMake tools configure step](configure.md#the-cmake-tools-configure-step)
22-
* [The configure step outside of CMake Tools](configure.md#the-configure-step-outside-of-cmake-tools)
23-
* [Clean configure](configure.md#clean-configure)
24-
25-
[Variants](variants.md)
26-
* [Variant YAML example](variants.md#example-yaml-variants-file)
27-
* [Variant schema](variants.md#variant-schema)
28-
* [Variant settings](variants.md#variant-settings)
29-
* [Variant options](variants.md#variant-options)
30-
* [How variants are applied](variants.md#how-variants-are-applied)
31-
* [Large variant file example](variants.md#large-variant-file-example)
32-
33-
[Build](build.md)
34-
* [Build the default target](build.md#build-the-default-target)
35-
* [Build a single target](build.md#build-a-single-target)
36-
* [How CMake tools builds your project](build.md#how-cmake-tools-builds)
37-
* [Clean build](build.md#clean-build)
38-
39-
[Debug and launch](debug-launch.md)
40-
* [Select a launch target](debug-launch.md#select-a-launch-target)
41-
* [Quick debugging](debug-launch.md#quick-debugging)
42-
* [Debug using a launch.json file](debug-launch.md#debug-using-a-launchjson-file)
43-
* [Run without debugging](debug-launch.md#run-without-debugging)
44-
* [Debugging CMake](debug.md)
45-
46-
[Configure CMake Tools settings](cmake-settings.md)
47-
* [CMake Tools settings](cmake-settings.md#cmake-settings)
48-
* [Variable substitution](cmake-settings.md#variable-substitution)
49-
5016
[Use CMakePresets](cmake-presets.md)
17+
5118
* [Configure and build with CMake Presets](cmake-presets.md#configure-and-build-with-cmake-presets)
5219
* [Supported CMake and CMakePresets.json versions](cmake-presets.md#supported-cmake-and-cmakepresetsjson-versions)
5320
* [Enable CMakePresets.json in the CMake Tools extension](cmake-presets.md#enable-cmakepresetsjson-in-the-cmake-tools-extension)
@@ -73,7 +40,49 @@ CMake Tools is an extension designed to make it easy to work with CMake-based pr
7340
* [Sourcing the environment when building with command line generators on Windows](cmake-presets.md#sourcing-the-environment-when-building-with-command-line-generators-on-windows)
7441
* [Example CMakePresets.json file](cmake-presets.md#example-cmakepresetsjson-file)
7542

43+
[Configure](configure.md)
44+
45+
* [CMake configuration process overview](configure.md#cmake-configuration-process-overview)
46+
* [The CMake tools configure step](configure.md#the-cmake-tools-configure-step)
47+
* [The configure step outside of CMake Tools](configure.md#the-configure-step-outside-of-cmake-tools)
48+
* [Clean configure](configure.md#clean-configure)
49+
50+
[Build](build.md)
51+
52+
* [Build the default target](build.md#build-the-default-target)
53+
* [Build a single target](build.md#build-a-single-target)
54+
* [How CMake tools builds your project](build.md#how-cmake-tools-builds)
55+
* [Clean build](build.md#clean-build)
56+
57+
[Debug and launch](debug-launch.md)
58+
59+
* [Select a launch target](debug-launch.md#select-a-launch-target)
60+
* [Quick debugging](debug-launch.md#quick-debugging)
61+
* [Debug using a launch.json file](debug-launch.md#debug-using-a-launchjson-file)
62+
* [Run without debugging](debug-launch.md#run-without-debugging)
63+
* [Debugging CMake](debug.md)
64+
65+
[Configure CMake Tools settings](cmake-settings.md)
66+
67+
* [CMake Tools settings](cmake-settings.md#cmake-settings)
68+
* [Variable substitution](cmake-settings.md#variable-substitution)
69+
70+
[Kits](kits.md)
71+
72+
* [How kits are found and defined](kits.md#how-kits-are-found-and-defined)
73+
* [Kit options](kits.md#kit-options)
74+
75+
[Variants](variants.md)
76+
77+
* [Variant YAML example](variants.md#example-yaml-variants-file)
78+
* [Variant schema](variants.md#variant-schema)
79+
* [Variant settings](variants.md#variant-settings)
80+
* [Variant options](variants.md#variant-options)
81+
* [How variants are applied](variants.md#how-variants-are-applied)
82+
* [Large variant file example](variants.md#large-variant-file-example)
83+
7684
[Troubleshoot CMake Tools](troubleshoot.md#troubleshoot-cmake-tools)
85+
7786
* [Common issues and resolutions](troubleshoot.md#common-issues-and-resolutions)
7887
* [CMake Tools is unable to provide IntelliSense configuration](troubleshoot.md#error-cmake-tools-is-unable-to-provide-intellisense-configuration)
7988
* [Green squiggles beneath #include directives](troubleshoot.md#green-squiggles-beneath-include-directives)
@@ -84,13 +93,15 @@ CMake Tools is an extension designed to make it easy to work with CMake-based pr
8493
* [Get help](troubleshoot.md#get-help)
8594

8695
[Frequently asked questions](faq.md)
96+
8797
* [How can I get help?](faq.md#how-can-i-get-help)
8898
* [What about CMake language support?](faq.md#what-about-cmake-language-support)
8999
* [How do I learn about CMake?](faq.md#how-do-i-learn-about-cmake)
90100
* [How does CMake Tools work with C and C++ IntelliSense?](faq.md#how-does-cmake-tools-work-with-c-and-c-intellisense)
91101
* [How do I perform common tasks](faq.md#how-do-i-perform-common-tasks)
92102

93103
[How to contribute](../CONTRIBUTING.md)
104+
94105
* [Developer Reference](../CONTRIBUTING.md#developer-reference)
95106
* [Build the CMake Tools extension](../CONTRIBUTING.md#build-the-cmake-tools-extension)
96107
* [Coding guidelines](../CONTRIBUTING.md#coding-guidelines)

docs/build.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ Selecting this button shows a quick pick list for all the targets CMake Tools is
3131
You can build a single target without changing the current build target from the VS Code command palette by running the **CMake: Build Target** command, or by pressing the keyboard shortcut (default is `Shift+F7`). CMake will build any dependent targets, even if they aren't directly selected.
3232

3333
## Create a build task
34+
3435
You can also define a build task from the VS Code command palette by running the **Tasks: Configure Task** command.
3536

3637
![Configure a build task](images/configure_task.png)
3738

3839
By choosing the "CMake: build" task, the following task will be created in "${workspaceFolder}/.vscode/tasks.json" file.
3940

40-
```
41+
```json
4142
{
4243
"version": "2.0.0",
4344
"tasks": [
@@ -58,7 +59,7 @@ By choosing the "CMake: build" task, the following task will be created in "${wo
5859

5960
The default target is set to "all" target (named ALL_BUILD in some generators). You can modify the "targets" value with a single target or a list of targets that can be built. Here is an example of two customized build tasks in which the name of the task, the list of targets, and the description of the tasks is modified:
6061

61-
```
62+
```json
6263
{
6364
"version": "2.0.0",
6465
"tasks": [
@@ -103,9 +104,9 @@ For advanced scenarios, additional flags to `--build` can be set with [cmake.bui
103104

104105
### The build environment
105106

106-
Environment variables are inherited from the calling Visual Studio Code process, with additional variables from the [cmake.buildEnvironment](cmake-settings.md#cmake-settings) and [cmake.environment](cmake-settings.md#cmake-settings) settings.
107+
Environment variables are inherited from the calling Visual Studio Code process, along with any additional variables set in the CMake [CMake Presets Environment](cmake-presets.md#set-and-reference-environment-variables).
107108

108-
If you are using a [Visual Studio Kit](kits.md#visual-Studio), CMake Tools runs the build with the appropriate environment variables set to build with the chosen version of Visual Studio, much like how it sets these environment variables during [the CMakeTools configure step](configure.md#the-cmake-tools-configure-step).
109+
If you are using either a cl.exe compiler or Ninja, and you have `cmake.useVsDeveloperEnvironment` set to `auto`, CMake Tools will attempt to detect and paply the appropriate environment variables set to build with the chosen version of Visual Studio. CMake Tools will do this no matter what if you set `cmake.useVsDeveloperEnviornment` to `always`.
109110

110111
## Clean build
111112

docs/cmake-presets.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ CMake supports two files that allow users to specify common configure, build, an
55
`CMakePresets.json` is for saving project-wide builds. `CMakeUserPresets.json` is for developers to save their own local builds. Their integration is available in CMake Tools version 1.7 and later.
66

77
This article contains information about `CMakePresets.json` integration in the CMake Tools extension for Visual Studio Code. Here are helpful links:
8+
89
- For more information on the format of `CMakePresets.json`, see the official [CMake documentation](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html).
910
- For more information on the Microsoft vendor maps and macro expansion, see [`CMakePresets.json` and `CMakeUserPresets.json` Microsoft vendor maps](https://docs.microsoft.com/cpp/build/cmake-presets-json-reference).
1011
- For more information on how to use `CMakePresets.json` in Visual Studio, see [Configure and build with CMake Presets in Visual Studio](https://docs.microsoft.com/cpp/build/cmake-presets-vs).
@@ -70,9 +71,21 @@ Select a Test Preset to make it the active Test Preset. This is the `testPreset`
7071

7172
All Test Presets must specify an associated `configurePreset` value. CMake Tools will hide Test Presets that don't apply to the active Configure Preset. For more information, see the [list of Test Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#test-preset).
7273

74+
### CMake: Select Package Preset
75+
76+
**CMake: Select Package Preset** lists the default Package Presets and the union of non-hidden Package Presets defined in `CMakePresets.json` and `CMakeUserPresets.json`. The default Package Preset will not perform a packaging.
77+
78+
Select a Package Preset to make it the active Package Preset. This is the `packagePreset` value that will be used when you invoke **CMake: Run CPack** to package. This will package your code in the format specified in the presets file.
79+
80+
### CMake: Select Workflow Preset
81+
82+
**CMake: Select Workflow Preset** lists the default Workflow Presets and the union of non-hidden Workflow Presets defined in `CMakePresets.json` and `CMakeUserPresets.json`. The default Workflow Preset will simply configure the project.
83+
84+
Selecte a Workflow Preset to make it the active Workflow Preset. This is the `workflowPreset` value that will be used when you invoke **CMake: Run Workflow**.
85+
7386
### CMake: Run Tests
7487

75-
To invoke CTest, run **CMake: Run Tests** from the command palette.
88+
To invoke CTest, run **CMake: Run Tests** from the command palette.
7689
When integration with the test explorer is enabled, using `cmake.ctest.testExplorerIntegrationEnabled`, the method of test execution will depend on `cmake.ctest.allowParallelJobs`. With `cmake.ctest.allowParallelJobs` disabled, each test will be run individually so that we can accurately track progress in the Test Explorer. When it is enabled, they will all be run in parallel, which is the same as running `ctest --preset <testPreset>` from the command line, where `<testPreset>` is the name of the active Test Preset.
7790

7891
### CMake Tools side bar Project Status View behavior
@@ -94,10 +107,10 @@ To add a new Configure Preset to `CMakePresets.json`, run the **CMake: Add Confi
94107

95108
![Screenshot of the list of configure presets.](images/add-configure-preset-vscode.png)
96109

97-
- Select **Inherit from Configure Preset** to inherit from an existing Configure Preset. For more information about inheritance, see the [list of Configure Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#configure-preset).
98-
- Select the **Toolchain File** template to configure your CMake project with a CMake toolchain file.
99-
- Select the **Custom** template to configure an empty Configure Preset.
100-
- Select **[Scan for Compilers]** to search for C/C++ compilers on your machine.
110+
- Select **Inherit from Configure Preset** to inherit from an existing Configure Preset. For more information about inheritance, see the [list of Configure Presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#configure-preset).
111+
- Select the **Toolchain File** template to configure your CMake project with a CMake toolchain file.
112+
- Select the **Custom** template to configure an empty Configure Preset.
113+
- Select **[Scan for Compilers]** to search for C/C++ compilers on your machine.
101114

102115
The selected template will be added to `CMakePresets.json` if `CMakePresets.json` exists. Otherwise, the template will be copied into a new `CMakePresets.json` file. For more information on editing Configure Presets, see [Edit presets](#edit-presets).
103116

@@ -117,6 +130,7 @@ For more information on editing Build Presets, see the [list of Build Presets](h
117130
### Add new Test Presets
118131

119132
To add a new Test Preset to `CMakePresets.json`, run the **CMake: Add Test Preset** command. This command lists several Test Preset templates in the command palette:
133+
120134
- Select **Create from Configure Preset** to display a list of `configurePresets` values defined in `CMakePresets.json`. After you select a Configure Preset, an empty Test Preset associated with the selected Configure Preset will be created.
121135
- Select **Inherit from Test Preset** to display a list of `testPresets` values defined in `CMakePresets.json`. After you select a Test Preset, a new Test Preset that inherits from the selected Test Preset will be created.
122136
- Select the **Custom** template to configure an empty Test Preset.
@@ -183,7 +197,7 @@ You can reference environment variables by using the `$env{<variable-name>}` and
183197

184198
The target architecture (x64, Win32, ARM64, or ARM) can be set with `architecture.value`. This is equivalent to passing `-A` to CMake from the command line. For more information, see [Platform Selection](https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2016%202019.html#platform-selection).
185199

186-
> [!Note]
200+
> [!NOTE]
187201
> Currently, Visual Studio Generators expect the Win32 syntax and command-line generators (like Ninja) expect the x86 syntax when you're building for x86.
188202
189203
You can set the host architecture (x64 or x86) and toolset by using `toolset.value`. This is equivalent to passing `-T` to CMake from the command line. For more information, see [Toolset Selection](https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2016%202019.html#toolset-selection).
@@ -212,17 +226,17 @@ Set the path to `vcpkg.cmake` with the `VCPKG_ROOT` environment variable in `CMa
212226
},
213227
```
214228

215-
`VCPKG_ROOT` should be set to the root of your vcpkg installation. For more information, see [vcpkg environment variables](https://learn.microsoft.com/en-us/vcpkg/users/config-environment#vcpkg_root).
229+
`VCPKG_ROOT` should be set to the root of your vcpkg installation. For more information, see [vcpkg environment variables](https://learn.microsoft.com/vcpkg/users/config-environment#vcpkg_root).
216230

217-
If you're already using a CMake toolchain file and want to enable vcpkg integration, see [Using multiple toolchain files](https://learn.microsoft.com/en-us/vcpkg/users/buildsystems/cmake-integration#using-multiple-toolchain-files). Follow those instructions to use an external toolchain file with a project by using vcpkg.
231+
If you're already using a CMake toolchain file and want to enable vcpkg integration, see [Using multiple toolchain files](https://learn.microsoft.com/vcpkg/users/buildsystems/cmake-integration#using-multiple-toolchain-files). Follow those instructions to use an external toolchain file with a project by using vcpkg.
218232

219233
## Substitute commands in `launch.json` and `settings.json`
220234

221235
CMake Tools supports command substitution for launch commands when `CMakePresets.json` integration is enabled. For more information, see [Command substitution](cmake-settings.md#command-substitution).
222236

223237
## Ignored settings
224238

225-
`CMakePresets.json` should be the source of truth for all settings related to configure, build, and test, except for settings that can be used as temporary overrides (see below). This eliminates behavior specific to Visual Studio Code and ensures that your CMake and CTest invocations can be reproduced from the command line.
239+
`CMakePresets.json` should be the source of truth for all settings related to configure, build, and test, except for settings that can be used as temporary overrides (see below). This eliminates behavior specific to Visual Studio Code and ensures that your CMake and CTest invocations can be reproduced from the command line.
226240

227241
The following settings in `settings.json` either duplicate options in `CMakePresets.json` or no longer apply. These settings will be ignored when `CMakePresets.json` integration is enabled.
228242

@@ -259,7 +273,7 @@ The following settings can be used temporarily when CMakePresets integration is
259273
## Unsupported commands
260274

261275
The following commands are not supported when `CMakePresets.json` integration is enabled:
262-
- **CMake: Quick Start**
276+
263277
- **CMake: Select Variant**
264278
- **CMake: Scan for Kits**
265279
- **CMake: Select a Kit**
@@ -282,7 +296,7 @@ If you're working on Windows, CMake must be on `PATH`.
282296

283297
Other troubleshooting steps include:
284298

285-
- Confirm that `cmake.exe` and your generator are installed and on `PATH`. If you're working on Windows, run the **CMake: Scan for Compilers** command so the extension can detect build tools installed with Visual Studio.
299+
- Confirm that `cmake.exe` and your generator are installed and on `PATH`, unless you've provided an absolute path. If you're working on Windows, run the **CMake: Scan for Compilers** command so the extension can detect build tools installed with Visual Studio.
286300
- Delete the cache and reconfigure the project (**CMake: Delete Cache and Reconfigure**).
287301
- Reset the CMake Tools extension state (**CMake: Reset CMake Tools Extension State**).
288302
- Increase the logging level (`cmake.loggingLevel` in `settings.json`) and/or check the log file (**CMake: Open the CMake Tools Log File**).

0 commit comments

Comments
 (0)