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/cmakesettings-reference.md
+7-6Lines changed: 7 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "CMakeSettings.json schema reference"
3
-
ms.date: "10/31/2019"
3
+
ms.date: "11/22/2019"
4
4
helpviewer_keywords: ["CMake in Visual C++"]
5
5
ms.assetid: 444d50df-215e-4d31-933a-b41841f186f8
6
6
---
@@ -127,10 +127,9 @@ When the active configuration specifies a Visual Studio generator, by default MS
127
127
-`remoteInstallRoot`: specifies the directory on the remote machine in which CMake generates install targets for the chosen generator. Supported macros include `${workspaceRoot}`, `${workspaceHash}`, `${projectFile}`, `${projectDir}`, `${thisFile}`, `${thisFileDir}`, `${name}`, `${generator}`, and `${env.VARIABLE}` where `VARIABLE` is an environment variable that has been defined at the system, user, or session level.
128
128
-`remoteCopySources`: A `boolean` that specifies whether Visual Studio should copy source files to the remote machine. The default is true. Set to false if you manage file synchronization yourself.
129
129
-`remoteCopyBuildOutput`: A `boolean` that specifies whether to copy the build outputs from the remote system.
130
-
-`remoteCopyAdditionalIncludeDirectories`:
131
-
-`remoteCopyExcludeDirectories`:
132
-
-`remoteCopyUseCompilerDefaults`:
133
-
130
+
-`remoteCopyAdditionalIncludeDirectories`: Additional include directories to be copied from the remote machine to support IntelliSense. Format as "/path1;/path2...".
131
+
-`remoteCopyExcludeDirectories`: Include directories NOT to copy from the remote machine. Format as "/path1;/path2...".
132
+
-`remoteCopyUseCompilerDefaults`: Specifies whether to use the compiler's default defines and include paths for IntelliSense. Should only be false if the compilers in use to not support gcc-style arguments.
134
133
-`rsyncCommandArgs`: specifies a set of additional command-line options passed to rsync.
135
134
-`remoteCopySourcesExclusionList`: A `array` that specifies a list of paths to be excluded when copying source files`: a path can be the name of a file/directory, or a path relative to root of the copy. Wildcards \\\"*\\\" and \\\"?\\\" can be used for glob pattern matching.
136
135
-`cmakeExecutable`: specifies the full path to the CMake program executable, including the file name and extension.
@@ -183,7 +182,9 @@ In `CMakeSettings.json`, you can define custom environment variables globally o
183
182
-`namespace`: names the environment so that its variables can be referenced from a configuration in the form `namespace.variable`. The default environment object is called `env` and is populated with certain system environment variables including `%USERPROFILE%`.
184
183
-`environment`: uniquely identifies this group of variables. Allows the group to be inherited later in an `inheritEnvironments` entry.
185
184
-`groupPriority`: An integer that specifies the priority of these variables when evaluating them. Higher number items are evaluated first.
186
-
-`inheritEnvironments`: An array of values that specify the set of environments that are inherited by this group. This feature enables you to inherit default environments and create custom environment variables that are passed to CMake.exe when it runs. In Visual Studio 2019 version 16.4 and later, debug targets are automatically launched with the environment you specify in *CMakeSettings.json*.
185
+
-`inheritEnvironments`: An array of values that specify the set of environments that are inherited by this group. This feature enables you to inherit default environments and create custom environment variables that are passed to CMake.exe when it runs.
186
+
187
+
**Visual Studio 2019 version 16.4 and later:** Debug targets are automatically launched with the environment you specify in *CMakeSettings.json*. You can override or add environment variables on a per-target or per-task basis in [launch.vs.json](launch-vs-schema-reference-cpp.md) and [tasks.vs.json](tasks-vs-json-schema-reference-cpp.md).
187
188
188
189
The following example defines one global variable, **BuildDir**, which is inherited in both the x86-Debug and x64-Debug configurations. Each configuration uses the variable to specify the value for the **buildRoot** property for that configuration. Note also how each configuration uses the **inheritEnvironments** property to specify a variable that applies only to that configuration.
Copy file name to clipboardExpand all lines: docs/build/launch-vs-schema-reference-cpp.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ Use the *launch.vs.json* file to configure debugging parameters. To create the f
18
18
|`project`|string|Specifies the relative path to the project file.|
19
19
|`projectTarget`|string|Specifies the optional target invoked when building `project`. This `projectTarget` must exist already and match the name in the **Debug Target** dropdown.|
20
20
|`debugType`|string|Specifies the debugging mode according to the type of code (native, managed, or mixed). This will automatically be detected unless this parameter is set. Allowed values: "native", "managed", "mixed".|
21
-
|`inheritEnvironments`|array|Specifies a set of environment variables inherited from multiple sources. You can define some variables in files like *CMakeSettings.json* or *CppProperties.json* and make them available to debug context|
21
+
|`inheritEnvironments`|array|Specifies a set of environment variables inherited from multiple sources. You can define some variables in files like *CMakeSettings.json* or *CppProperties.json* and make them available to debug context. **Visual Studio 16.4:**: Specify environment variables on a per-target basis using the `env.VARIABLE_NAME` syntax. To unset a variable, set it to "null".|
22
22
|`args`|array|Specifies the command-line arguments passed to the launched program.|
23
23
|`currentDir`|string|Specifies the full directory path to the Build Target. This will automatically be detected unless this parameter is set.|
24
24
|`noDebug`|boolean|Specifies whether to debug the launched program. The default value for this parameter is `false` if not specified.|
If, for example, you choose **x64-Debug**, Visual Studio creates a file called *CppProperties.json* in your root project folder and populates it like so:
43
+
If, for example, you choose **x64-Debug**, Visual Studio creates a file called *CppProperties.json* in your root project folder:
44
44
45
45
```json
46
46
{
@@ -66,19 +66,18 @@ If, for example, you choose **x64-Debug**, Visual Studio creates a file called *
66
66
}
67
67
```
68
68
69
-
This configuration "inherits" the environment variables of the Visual Studio [x64 Developer Command Prompt](building-on-the-command-line.md). One of those variables is `INCLUDE` and you can refer to it here by using the `${env.INCLUDE}` macro. The `includePath` property tells Visual Studio where to look for all the sources that it needs for IntelliSense. In this case, it says "look in the all the directories specified by the INCLUDE environment variable, and also all the directories in the current working folder tree." The `name` property is the name that will appear in the dropdown, and can be anything you like. The `defines` property provides hints to IntelliSense when it encounters conditional compilation blocks. The `intelliSenseMode` property provides some additional hints based on the compiler type. Several options are available for MSVC, GCC, and Clang.
69
+
This configuration inherits the environment variables of the Visual Studio [x64 Developer Command Prompt](building-on-the-command-line.md). One of those variables is `INCLUDE` and you can refer to it here by using the `${env.INCLUDE}` macro. The `includePath` property tells Visual Studio where to look for all the sources that it needs for IntelliSense. In this case, it says "look in the all the directories specified by the INCLUDE environment variable, and also all the directories in the current working folder tree." The `name` property is the name that will appear in the dropdown, and can be anything you like. The `defines` property provides hints to IntelliSense when it encounters conditional compilation blocks. The `intelliSenseMode` property provides some additional hints based on the compiler type. Several options are available for MSVC, GCC, and Clang.
70
70
71
71
> [!NOTE]
72
72
> If Visual Studio seems to be ignoring settings in *CppProperties.json*, try adding an exception to your *.gitignore* file like this: `!/CppProperties.json`.
73
73
74
-
## Example configuration for GCC
74
+
## Default configuration for MIngw-W64
75
75
76
-
If you are using a compiler other than Microsoft C++, you have to create a custom configuration and environment in *CppProperties.json*. The following example shows a complete *CppProperties.json* file with a single custom configuration for using GCC in an MSYS2 installation:
76
+
If you add the Mingw-W64 configuration, the JSON looks this this:
77
77
78
78
```json
79
79
{
80
-
"configurations": [
81
-
{
80
+
{
82
81
"inheritEnvironments": [
83
82
"mingw_64"
84
83
],
@@ -93,21 +92,18 @@ If you are using a compiler other than Microsoft C++, you have to create a custo
Note the `environments` block. It defines properties that behave like environment variables and are available not only in the *CppProperties.json* file, but also in the other configuration files *task.vs.json* and *launch.vs.json*. The `Mingw64` configuration inherits the `mingw_w64` environment, and uses its `INCLUDE` property to specify the value for `includePath`. You can add other paths to this array property as needed.`
107
106
108
-
> [!WARNING]
109
-
> There is currently a known issue in which the `INCLUDE` value specified in `environments` is not correctly passed to the `includePath` property. You can work around the issue by adding the complete literal include paths to the `includePath` array.
110
-
111
107
The `intelliSenseMode` property is set to a value appropriate for GCC. For more information on all these properties, see [CppProperties schema reference](cppproperties-schema-reference.md).
112
108
113
109
When everything is working correctly, you will see IntelliSense from the GCC headers when you hover over a type:
@@ -151,7 +147,7 @@ This creates (or opens) the *tasks.vs.json* file in the .vs folder which Visual
151
147
152
148
```
153
149
154
-
The JSON file is placed in the *.vs* subfolder which you can see if you click on the **Show All Files** button at the top of **Solution Explorer**. You can run this task by right-clicking on the root node in **Solution Explorer** and choosing **build hello**. When the task completes you should see a new file, *hello.exe* in **Solution Explorer**.
150
+
The JSON file is placed in the *.vs* subfolder. To see that folder, click on the **Show All Files** button at the top of **Solution Explorer**. You can run this task by right-clicking on the root node in **Solution Explorer** and choosing **build hello**. When the task completes you should see a new file, *hello.exe* in **Solution Explorer**.
155
151
156
152
You can define many kinds of tasks. The following example shows a *tasks.vs.json file* that defines a single task. `taskLabel` defines the name that appears in the context menu. `appliesTo` defines which files the command can be performed on. The `command` property refers to the COMSPEC environment variable, which identifies the path for the console (*cmd.exe* on Windows). You can also reference environment variables that are declared in CppProperties.json or CMakeSettings.json. The `args` property specifies the command line to be invoked. The `${file}` macro retrieves the selected file in **Solution Explorer**. The following example will display the filename of the currently selected .cpp file.
Copy file name to clipboardExpand all lines: docs/build/tasks-vs-json-schema-reference-cpp.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ The default properties are available on all types of tasks:
21
21
|`appliesTo`|string| (Required.) Specifies which files the command can be performed on. The use of wildcards is supported, for example: "*", "*.cpp", "/*.txt"|
22
22
|`contextType`|string| Allowed values: "custom", "build", "clean", "rebuild". Determines where in the context menu the task will appear. Defaults to "custom".|
23
23
|`output`|string| Specifies an output tag to your task.|
24
-
|`inheritEnvironments`|array| Specifies a set of environment variables inherited from multiple sources. You can define variables in files like *CMakeSettings.json* or *CppProperties.json* and make them available to the task context.|
24
+
|`inheritEnvironments`|array| Specifies a set of environment variables inherited from multiple sources. You can define variables in files like *CMakeSettings.json* or *CppProperties.json* and make them available to the task context.**Visual Studio 16.4:**: Specify environment variables on a per-task basis using the `env.VARIABLE_NAME` syntax. To unset a variable, set it to "null".|
25
25
|`passEnvVars`|boolean| Specifies whether or not to include additional environment variables to the task context. These variables are different from the ones defined using the `envVars` property. Defaults to "true".|
0 commit comments