|
1 | 1 | --- |
2 | 2 | title: "CMake projects in Visual Studio" |
3 | 3 | description: "How to create and build C++ projects using CMake in Visual Studio." |
4 | | -ms.date: 12/15/2021 |
| 4 | +ms.date: 02/14/2022 |
5 | 5 | helpviewer_keywords: ["CMake in Visual C++"] |
6 | 6 | ms.assetid: 444d50df-215e-4d31-933a-b41841f186f8 |
7 | 7 | --- |
@@ -41,9 +41,9 @@ When you **open a folder** containing a *`CMakeLists.txt`* file, the following t |
41 | 41 | > [!NOTE] |
42 | 42 | > Starting in Visual Studio 2022 version 17.1 Preview 2, if your folder doesn't contain a root `CMakeLists.txt` you'll be prompted whether you'd like to enable CMake integration or not. For more information, see [CMake partial activation](#cmake-partial-activation). |
43 | 43 |
|
44 | | -Once CMake cache generation has succeeded, you can also view your projects organized logically by targets. Choose **Targets view** from the dropdown in the **Solution Explorer** toolbar: |
| 44 | +Once CMake cache generation has succeeded, you can also view your projects organized logically by targets. Choose the **Select View** button on the **Solution Explorer** toolbar. From the list in **Solution Explorer - Views**, select **CMake Targets View** and press **Enter** to open the targets view: |
45 | 45 |
|
46 | | - |
| 46 | +:::image type="content" source="media/cmake-targets-view-dark.png" alt-text="Screenshot of the Solution Explorer window with the Select View toolbar button highlighted."::: |
47 | 47 |
|
48 | 48 | Choose the **Show All Files** button at the top of **Solution Explorer** to see all the CMake-generated output in the *`out/build/<config>`* folders. |
49 | 49 |
|
@@ -90,7 +90,7 @@ You can also disable all CMake cache notifications (gold bars) by deselecting ** |
90 | 90 |
|
91 | 91 | If you need more information about the state of the CMake cache to diagnose a problem, open the **Project** main menu or the *`CMakeLists.txt`* context menu in **Solution Explorer** to run one of these commands: |
92 | 92 |
|
93 | | -- **View CMakeCache.txt** opens the *`CMakeCache.txt`* file from the build directory in the editor. Any edits you make here to *`CMakeCache.txt`* are wiped out if you clean the cache. To make changes that persist after you clean the cache, see [Customize CMake settings](customize-cmake-settings.md) or [Configure and Build with CMake Presets](cmake-presets-vs.md). |
| 93 | +- **View CMakeCache.txt** opens the *`CMakeCache.txt`* file from the build directory in the editor. Any edits you make here to *`CMakeCache.txt`* are wiped out if you clean the cache. To make changes that persist after you clean the cache, see [Customize CMake settings](customize-cmake-settings.md) or [Configure and build with CMake Presets](cmake-presets-vs.md). |
94 | 94 |
|
95 | 95 | - **Delete Cache and Reconfigure** deletes the build directory and reconfigures from a clean cache. |
96 | 96 |
|
@@ -149,7 +149,7 @@ Visual Studio allows you to debug a process running on a remote Linux system or |
149 | 149 |
|
150 | 150 | ## <a name="cmake-partial-activation"></a> CMake partial activation |
151 | 151 |
|
152 | | -Starting in Visual Studio 2022 version 17.1 Preview 2, CMake functionality won't be enabled automatically if your root folder doesn't contain a `CMakeLists.txt` file. Instead, a dialog will prompt you on whether you'd like to enable CMake functionality for your project. If you decline, CMake cache generation won't start and CMake configurations (from `CMakeSettings.json` or `CMakePresets.json`) won't appear in the configuration dropdown. If you accept, you'll be taken to a workspace-level configuration file, `CMakeWorkspaceSettings.json` (stored in the `.vs` directory), to specify the folders you'd like to enable CMake for. (These folders contain your root `CMakeLists.txt` files). |
| 152 | +In Visual Studio 2022 version 17.1 and later, CMake functionality won't be enabled automatically if your root folder doesn't contain a `CMakeLists.txt` file. Instead, a dialog will prompt you on whether you'd like to enable CMake functionality for your project. If you decline, CMake cache generation won't start and CMake configurations (from `CMakeSettings.json` or `CMakePresets.json`) won't appear in the configuration dropdown. If you accept, you'll be taken to a workspace-level configuration file, `CMakeWorkspaceSettings.json` (stored in the `.vs` directory), to specify the folders you'd like to enable CMake for. (These folders contain your root `CMakeLists.txt` files). |
153 | 153 |
|
154 | 154 | The accepted properties are: |
155 | 155 |
|
@@ -197,7 +197,7 @@ As soon as you save the file, the configuration step automatically runs again an |
197 | 197 |
|
198 | 198 | ### Language services for CMake |
199 | 199 |
|
200 | | -Language services for CMake are available in Visual Studio 2019 version 16.5 or later. Code navigation features like Go To Definition, Peek Definition, and Find All References are supported for CMake variables, functions, and targets in CMake script files. For more information, see [Code Navigation for CMake Scripts](https://devblogs.microsoft.com/cppblog/code-navigation-for-cmake-scripts/). |
| 200 | +Language services for CMake are available in Visual Studio 2019 version 16.5 or later. It supports code navigation features like Go To Definition, Peek Definition, and Find All References for CMake variables, functions, and targets in CMake script files. For more information, see [Code Navigation for CMake Scripts](https://devblogs.microsoft.com/cppblog/code-navigation-for-cmake-scripts/). |
201 | 201 |
|
202 | 202 |  |
203 | 203 |
|
|
0 commit comments