Skip to content

Commit 015629f

Browse files
committed
Add new moniker
1 parent 5272114 commit 015629f

2 files changed

Lines changed: 20 additions & 54 deletions

File tree

docs/build/customize-cmake-settings.md

Lines changed: 20 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,25 @@ ms.topic: how-to
77
---
88
# Customize CMake build settings
99

10-
::: moniker range=">=msvc-160"
10+
::: moniker range="=visual-studio"
11+
12+
The CMake settings editor has been deprecated in Visual Studio 2026.
13+
14+
To learn about changing the *`CMakePresets.json`* file, see [CMakePresets.json and CMakeUserPresets.json Microsoft vendor maps](/cpp/build/cmake-presets-json-reference).
15+
16+
For Visual Studio 2019 to 2022, select your version by using the version selector in the sidebar menu.
17+
18+
::: moniker-end
19+
20+
::: moniker range="<=msvc-170"
1121

1222
Visual Studio uses a CMake configuration file to drive CMake generation and build. *`CMakePresets.json`* is supported by Visual Studio 2019 version 16.10 or later and is the recommended CMake configuration file. *`CMakePresets.json`* is supported directly by CMake and can be used to drive CMake generation and build from Visual Studio, from VS Code, in a Continuous Integration pipeline, and from the command line on Windows, Linux, and Mac. For more information on *`CMakePresets.json`*, see [Configure and build with CMake Presets](cmake-presets-vs.md).
1323

1424
If you maintain projects that use a *`CMakeSettings.json`* file for CMake build configuration, Visual Studio 2019 and later versions provide a **CMake settings editor**. The editor lets you add CMake configurations and customize their settings easily. It's intended to be a simpler alternative to manually editing the *`CMakeSettings.json`* file. However, if you prefer to edit the file directly, you can select the **Edit JSON** link in the upper right of the editor.
1525

1626
To open the CMake settings editor, select the **Configuration** drop-down in the main toolbar and choose **Manage Configurations**.
1727

18-
![Screenshot of the CMake configuration drop-down. Manage Configurations is highlighted.](media/vs-2026-cmake-manage-configurations.png)
28+
![Screenshot of the CMake configuration drop-down. Manage Configurations is highlighted.](media/vs2019-cmake-manage-configurations.png)
1929

2030
Now you see the **Settings Editor** with the installed configurations on the left.
2131

@@ -24,7 +34,7 @@ The left pane shows the installed configurations (x86-Debug). The right pane sho
2434
:::image-end:::
2535

2636
> [!NOTE]
27-
> If a JSON editor opens instead of the **Settings Editor** when you select **Manage Configurations**, you need to enable the CMakeSettings mode. In Visual Studio 2026, under **Tools** > **Options** > **CMake**, select **Never use CMake Presets**, and then close and reopen your CMake project. Alternatively, you can choose **Use CMake Presets if available, otherwise use CMakeSettings.json**, and then delete the *CMakePresets.json* file from the project folder.
37+
> If a JSON editor opens instead of the **Settings Editor** when you select **Manage Configurations**, you need to enable the CMakeSettings mode. Under **Tools** > **Options** > **CMake**, select **Never use CMake Presets**, and then close and reopen your CMake project. Alternatively, you can choose **Use CMake Presets if available, otherwise use CMakeSettings.json**, and then delete the *CMakePresets.json* file from the project folder.
2838
> :::image type="content" source="media/options-configuration-file.png" alt-text="Screenshot of the C make options pane.":::
2939
3040
Visual Studio provides one `x64-Debug` configuration by default. You can add more configurations by choosing the green plus sign. The settings that you see in the editor might vary depending on which configuration is selected.
@@ -161,55 +171,11 @@ For more information about each of the properties in the file, see [CMakeSetting
161171

162172
::: moniker-end
163173

164-
::: moniker range="<=msvc-150"
165-
166-
Visual Studio 2017 provides several CMake configurations that define how CMake is invoked to create the CMake cache for a given project. To add a new configuration, select the configuration drop-down in the toolbar and choose **Manage Configurations**:
167-
168-
![Screenshot of Manage configurations selected in the drop-down.](media/cmake-manage-configurations.png)
169-
170-
You can choose from the list of predefined configurations:
171-
172-
![Add Configuration to CMake Settings dialog list of predefined configurations.](media/cmake-configurations.png)
173-
174-
The first time you select a configuration, Visual Studio creates a *`CMakeSettings.json`* file in your project's root folder. This file is used to re-create the CMake cache file, for example after a **Clean** operation.
175-
176-
To add another configuration, right-click *`CMakeSettings.json`* and choose **Add Configuration**.
177-
178-
![Screenshot of the shortcut menu with Add configuration selected.](media/cmake-add-configuration.png "CMake Add Configuration")
179-
180-
You can also edit the file using the **CMake Settings Editor**. Right-click on *`CMakeSettings.json`* in **Solution Explorer** and choose **Edit CMake Settings**. Or, select **Manage Configurations** from the configuration drop-down at the top of the editor window.
181-
182-
You can also directly edit *`CMakeSettings.json`* to create custom configurations. The following example shows a sample configuration, which you can use as a starting point:
183-
184-
```json
185-
{
186-
"name": "x86-Debug",
187-
"generator": "Ninja",
188-
"configurationType": "Debug",
189-
"inheritEnvironments": [ "msvc_x86" ],
190-
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
191-
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
192-
"cmakeCommandArgs": "",
193-
"buildCommandArgs": "-v",
194-
"ctestCommandArgs": ""
195-
},
196-
```
197-
198-
JSON IntelliSense helps you edit the *`CMakeSettings.json`* file:
199-
200-
:::image type="complex" source="media/cmake-json-intellisense.png" alt-text="Screenshot of the CMake JSON IntelliSense pop-up in the editor.":::
201-
The JSON IntelliSense pop-up for "configurations" shows buildCommandArgs, buildRoot, cmakeCommandArgs, configurationType, among several others.
202-
:::image-end:::
203-
204-
For more information about each of the properties in the file, see [`CMakeSettings.json` schema reference](cmakesettings-reference.md).
205-
206-
::: moniker-end
207-
208-
## See also
174+
## Related content
209175

210-
[CMake Projects in Visual Studio](cmake-projects-in-visual-studio.md)<br/>
211-
[Configure a Linux CMake project](../linux/cmake-linux-project.md)<br/>
212-
[Connect to your remote Linux computer](../linux/connect-to-your-remote-linux-computer.md)<br/>
213-
[Configure CMake debugging sessions](configure-cmake-debugging-sessions.md)<br/>
214-
[Deploy, run, and debug your Linux project](../linux/deploy-run-and-debug-your-linux-project.md)<br/>
215-
[CMake predefined configuration reference](cmake-predefined-configuration-reference.md)
176+
- [CMake Projects in Visual Studio](cmake-projects-in-visual-studio.md)
177+
- [Configure a Linux CMake project](../linux/cmake-linux-project.md)
178+
- [Connect to your remote Linux computer](../linux/connect-to-your-remote-linux-computer.md)
179+
- [Configure CMake debugging sessions](configure-cmake-debugging-sessions.md)
180+
- [Deploy, run, and debug your Linux project](../linux/deploy-run-and-debug-your-linux-project.md)
181+
- [CMake predefined configuration reference](cmake-predefined-configuration-reference.md)
-10.3 KB
Binary file not shown.

0 commit comments

Comments
 (0)