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
@@ -15,7 +15,7 @@ CMake projects are supported in Visual Studio 2017 and later.
15
15
16
16
::: moniker range=">=msvc-150"
17
17
18
-
In a CMake project, build configurations are stored in a CMakeSettings.json file. When you choose **Manage Configurations** from the build configuration dropdown in the main toolbar, a dialog appears that shows the default CMake configurations available in Visual Studio:
18
+
In a CMake project, build configurations are stored in a *`CMakeSettings.json`* file. When you choose **Manage Configurations** from the build configuration dropdown in the main toolbar, a dialog appears that shows the default CMake configurations available in Visual Studio:
19
19
20
20
- x86 Debug
21
21
- x86 Release
@@ -28,7 +28,7 @@ In a CMake project, build configurations are stored in a CMakeSettings.json file
28
28
- MinGW Debug
29
29
- MinGW Release
30
30
31
-
When you choose a configuration, it is added to the *CMakeSettings.json* file in the project's root folder. You can then use it to build your project. For information about the configuration properties, see [CMakeSettings reference](cmakesettings-reference.md).
31
+
When you choose a configuration, it's added to the *`CMakeSettings.json`* file in the project's root folder. You can then use it to build your project. For information about the configuration properties, see [CMakeSettings reference](cmakesettings-reference.md).
32
32
33
33
## Linux predefined build configurations:
34
34
@@ -92,7 +92,6 @@ When you choose a configuration, it is added to the *CMakeSettings.json* file in
92
92
},
93
93
```
94
94
95
-
96
95
You can use these optional settings for more control:
97
96
98
97
```json
@@ -350,7 +349,7 @@ These options allow you to run commands on the remote system before and after bu
350
349
351
350
::: moniker range="msvc-160"
352
351
353
-
In a CMake project, build configurations are stored in a CMakeSettings.json file. When you choose **Manage Configurations** from the build configuration dropdown in the main toolbar, a dialog appears that shows the default CMake configurations available in Visual Studio:
352
+
In a CMake project, build configurations are stored in a *`CMakeSettings.json`* file. When you choose **Manage Configurations** from the build configuration dropdown in the main toolbar, a dialog appears that shows the default CMake configurations available in Visual Studio:
354
353
355
354
- x86 Debug
356
355
- x86 Clang Debug
@@ -374,7 +373,7 @@ In a CMake project, build configurations are stored in a CMakeSettings.json file
374
373
- WSL Clang Release
375
374
- Clang
376
375
377
-
When you choose a configuration, it is added to the CMakeSettings.json file in the project's root folder. You can then use it to build your project.
376
+
When you choose a configuration, it's added to the *`CMakeSettings.json`* file in the project's root folder. You can then use it to build your project.
Copy file name to clipboardExpand all lines: docs/build/cmake-remote-debugging.md
+24-20Lines changed: 24 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,9 @@ description: "How to use Visual Studio C++ on Windows to create and build a CMak
7
7
8
8
# Tutorial: Debug a CMake project on a remote Windows machine
9
9
10
-
This tutorial uses Visual Studio C++ on Windows to create and build a CMake project that you can deploy and debug on a remote Windows machine. This tutorial is specific to Windows ARM64, but the steps can be generalized for other architectures.
10
+
This tutorial uses Visual Studio C++ on Windows to create and build a CMake project that you can deploy and debug on a remote Windows machine. The tutorial is specific to Windows ARM64, but the steps can be generalized for other architectures.
11
11
12
-
In Visual Studio, the default debugging experience for ARM64 is remote debugging an ARM64 Windows machine. If you try to debug an ARM64 CMake project without configuring your debug settings as shown in this tutorial, you'll get an error that Visual Studio can't find the remote machine.
12
+
In Visual Studio, the default debugging experience for ARM64 is remote debugging an ARM64 Windows machine. Configure your debug settings as shown in this tutorial. Otherwise, when you try to debug an ARM64 CMake project, you'll get an error that Visual Studio can't find the remote machine.
13
13
14
14
In this tutorial, you'll learn how to:
15
15
@@ -24,7 +24,7 @@ In this tutorial, you'll learn how to:
24
24
25
25
### On the host machine
26
26
27
-
To set up Visual Studio for cross-platform C++ development, install the build tools for the target architecture. For this tutorial, install the ARM64 build tools by doing the following:
27
+
To set up Visual Studio for cross-platform C++ development, install the build tools for the target architecture. For this tutorial, install the ARM64 build tools by doing these steps:
28
28
29
29
1. Run the Visual Studio Installer. If you haven't installed Visual Studio yet, see [Install Visual Studio](/visualstudio/install/install-visual-studio)
30
30
1. On the Visual Studio Installer home screen, choose **Modify**.
@@ -43,6 +43,7 @@ To set up Visual Studio for cross-platform C++ development, install the build to
43
43
## Create a CMake project
44
44
45
45
On the Windows host machine:
46
+
46
47
1. Run Visual Studio
47
48
1. From the main menu, select **File** > **New** > **Project**.
48
49
1. Select **CMake Project** > **Next**
@@ -63,18 +64,19 @@ In the **CMakeSettings** dialog that appears, select **arm64-debug**, and then p
This adds a debug configuration named **arm64-Debug** to your *`CmakeSettings.json`* file. This configuration name is a unique, friendly name that makes it easier for you to identify these settings in the **Configuration** dropdown.
67
+
This command adds a debug configuration named `arm64-Debug` to your *`CmakeSettings.json`* file. This configuration name is a unique, friendly name that makes it easier for you to identify these settings in the **Configuration** dropdown.
67
68
68
-
The **Toolset** dropdown will be set to **msvc_arm64_x64**. Your settings should now look like this:
69
+
The **Toolset** dropdown is set to **msvc_arm64_x64**. Your settings should now look like this:
> In the **Toolset** dropdown, **msvc_arm64** selects 32-bit host tools to cross-compile to ARM64, whereas **msvc_arm64 x64** selects 64-bit host tools to cross-compile to ARM64--which is what you will do in this tutorial.
74
+
> In the **Toolset** dropdown, **msvc_arm64** selects 32-bit host tools to cross-compile to ARM64, whereas **msvc_arm64 x64** selects 64-bit host tools to cross-compile to ARM64, which is what you'll do in this tutorial.
75
+
76
+
Save the *`CMakeSettings.json`* file. In the configuration dropdown, select **arm64-debug**. (It may take a moment after saving the *`CMakeSettings.json`* file for it to appear in the list):
74
77
75
-
Save the `CMakeSettings.json` file. In the configuration dropdown, select **arm64-debug** (it may take a moment after saving the `CMakeSettings.json` file for it to appear in the list):
78
+

76
79
77
-

78
80
79
81
## Add a debug configuration file
80
82
@@ -90,18 +92,19 @@ Open the project folder (in this example, **CMakeProject3 Project**), and then r
This creates a `launch.vs.json` file in your project. Open it and change the following entries to enable remote debugging:
95
+
This command creates a *`launch.vs.json`* file in your project. Open it and change the following entries to enable remote debugging:
94
96
95
-
-`projectTarget`: this is set for you if you added the debug configuration file from the **Solution Explorer** targets view per the instructions above.
97
+
-`projectTarget`: this value is set for you if you added the debug configuration file from the **Solution Explorer** targets view per the instructions above.
96
98
-`remoteMachineName`: set to the IP address of the remote ARM64 machine, or its machine name.
97
99
98
-
For more information about `launch.vs.json` settings, see [launch.vs.json schema reference](launch-vs-schema-reference-cpp.md).
100
+
For more information about *`launch.vs.json`* settings, see [`launch.vs.json` schema reference](launch-vs-schema-reference-cpp.md).
99
101
100
102
> [!Note]
101
-
> If you're using the folder view instead of the targets view in **Solution Explorer**, right-click the `CMakeLists.txt` file and select **Add Debug Configuration**. This experience differs from adding the debug configuration from the targets view in the following ways:
103
+
> If you're using the folder view instead of the targets view in **Solution Explorer**, right-click the *`CMakeLists.txt`* file and select **Add Debug Configuration**. This experience differs from adding the debug configuration from the targets view in the following ways:
104
+
>
102
105
> - You'll be asked to select a debugger (select **C/C++ Remote Windows Debug**).
103
-
> - Visual Studio will provide less configuration template information in the `launch.vs.json` file so you'll need to add it yourself. You'll need to provide the `remoteMachineName` and `projectTarget` entries. When you add the configuration from the targets view, you only need to specify `remoteMachineName`.
104
-
> - For the `projectTarget` setting value, check the startup item dropdown to get the unique name of your target, for example, in this tutorial it is `CMakeProject3.exe'.
106
+
> - Visual Studio will provide less configuration template information in the *`launch.vs.json`* file so you'll need to add it yourself. You'll need to provide the `remoteMachineName` and `projectTarget` entries. When you add the configuration from the targets view, you only need to specify `remoteMachineName`.
107
+
> - For the `projectTarget` setting value, check the startup item dropdown to get the unique name of your target, for example, in this tutorial it is *`CMakeProject3.exe`*'.
105
108
106
109
## Start the remote debugger monitor on the remote Windows machine
107
110
@@ -111,7 +114,7 @@ For example, on the remote machine, from the Visual Studio Remote Debugger menu
Then, in Visual Studio on the host machine, update the `launch.vs.json` file to match. For example, if you choose **No Authentication** on the remote debugger, update the `launch.vs.json` file in your project by adding **"authenticationType": "none"** to the `configurations` section `launch.vs.json`. Otherwise, `"authenticationType"` defaults to `"windows"` and doesn't need to be explicitly stated. This example shows a `launch.vs.json` file configured for no authentication:
117
+
Then, in Visual Studio on the host machine, update the *`launch.vs.json`* file to match. For example, if you choose **No Authentication** on the remote debugger, update the *`launch.vs.json`* file in your project by adding `"authenticationType": "none"` to the `configurations` section *`launch.vs.json`*. Otherwise, `"authenticationType"` defaults to `"windows"` and doesn't need to be explicitly stated. This example shows a *`launch.vs.json`* file configured for no authentication:
115
118
116
119
```XAML
117
120
{
@@ -147,19 +150,20 @@ On the host machine, in the Visual Studio **Solution Explorer**, open the CPP fi
147
150
148
151
The default CPP file is a simple hello world console app. Set a breakpoint on `return 0;`.
149
152
150
-
On the Visual Studio toolbar, use the **Startup Item** dropdown to select the name you specified for `"name"` in your `launch.vs.json` file:
153
+
On the Visual Studio toolbar, use the **Startup Item** dropdown to select the name you specified for `"name"` in your *`launch.vs.json`* file:
151
154
152
155

153
156
154
157
To start debugging, on the Visual Studio toolbar choose **Debug** > **Start Debugging** (or press **F5**).
155
158
156
-
If it doesn't start, ensure that the following are set correctly in the `launch.vs.json` file:
159
+
If it doesn't start, ensure that the following are set correctly in the *`launch.vs.json`* file:
160
+
157
161
-`"remoteMachineName"` should be set to the IP address, or the machine name, of the remote ARM64 Windows machine.
158
162
-`"name"` should match the selection in the Visual Studio startup item dropdown.
159
163
-`"projectTarget"` should match the name of the CMake target you want to debug.
160
164
-`"type"` should be `"remoteWindows"`
161
-
- If the authentication type on the remote debugger is set to **No Authentication**, you should have `"authenticationType": "none"` set in the `launch.vs.json` file.
162
-
- If you are using Windows authentication, sign in when prompted using an account recognized by the remote machine.
165
+
- If the authentication type on the remote debugger is set to **No Authentication**, you should have `"authenticationType": "none"` set in the *`launch.vs.json`* file.
166
+
- If you're using Windows authentication, sign in when prompted using an account recognized by the remote machine.
163
167
164
168
After the project builds, the app should appear on the remote ARM64 Windows machine:
165
169
@@ -180,4 +184,4 @@ Learn more about configuring and debugging CMake projects in Visual Studio:
0 commit comments