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: docs/build/configure-cmake-debugging-sessions.md
+16-2Lines changed: 16 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -16,14 +16,28 @@ Native CMake support is available in Visual Studio 2017 and later. To see the do
16
16
17
17
All executable CMake targets are shown in the **Startup Item** dropdown in the toolbar. Select one to start a debugging session and launch the debugger.
18
18
19
-

19
+
:::image type="complex" source="media/new-dropdowns.png" alt-text="Screenshot of the CMake startup items.":::
20
+
There is a play button dropdown to select the current debug target. It shows your debug targets. In this example, the HelloWorld.exe debug target is available.
21
+
:::image-end:::
20
22
21
23
You can also start a debug session from Solution Explorer. First, switch to **CMake Targets View** in the **Solution Explorer** window.
22
24
23
-

25
+
:::image type="complex" source="media/switch-to-targets-view.png" alt-text="Screenshot of the CMake Targets View menu":::
26
+
The solution explorer is shown. A right-click on an item in the Folder View has opened a menu. On that menu, the Switch to Targets View item is highlighted.
27
+
:::image-end:::
24
28
25
29
Then, right-click on an executable and select **Debug**. This command automatically starts debugging the selected target based on your active configuration.
26
30
31
+
:::image type="complex" source="media/debug-targets-view.png" alt-text="Screenshot of the CMake Targets View debug option menu.":::
32
+
When you right-click on a target in the CMake Targets view, there is an option to debug a chosen target. The Debug option is highlighted.
33
+
:::image-end:::
34
+
35
+
Starting in Visual Studio 2022 Version 17.6, you can also start a debugging session on your CMakeLists.txt file. To do so, just set a breakpoint in your CMakeLists.txt file and run **Configure Project with CMake Debugger** from the **Project** dropdown.
36
+
37
+
:::image type="complex" source="media/cmake-debugger-entry.png" alt-text="Screenshot of the CMake Debugger dropdown.":::
38
+
The Project dropdown is shown. The option to Configure Project with CMake debugger is highlighted.
39
+
:::image-end:::
40
+
27
41
## Customize debugger settings
28
42
29
43
You can customize the debugger settings for any executable CMake target in your project. They're found in a configuration file called *launch.vs.json*, located in a *`.vs`* folder in your project root. A launch configuration file is useful in most debugging scenarios, because you can configure and save your debugging setup details. There are three entry points to this file:
0 commit comments