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
|[_ATL_ALL_WARNINGS](#_atl_all_warnings)|A symbol that enables errors in projects converted from previous versions of ATL.|
16
-
|[_ATL_APARTMENT_THREADED](#_atl_apartment_threaded)|Define if one or more of your objects use apartment threading.|
17
-
|[_ATL_CSTRING_EXPLICIT_CONSTRUCTORS](#_atl_cstring_explicit_constructors)|Makes certain `CString` constructors explicit, preventing any unintentional conversions.|
18
-
|[_ATL_ENABLE_PTM_WARNING](#_atl_enable_ptm_warning)|Define this macro to require C++ standard syntax. It generates the C4867 compiler error when non-standard syntax is used to initialize a pointer to a member function.|
19
-
|[_ATL_FREE_THREADED](#_atl_free_threaded)|Define if one or more of your objects use free or neutral threading.|
20
-
|[_ATL_MODULES](#_ATL_MODULES)|Allows you to compile ATL projects with [permissive-](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).|
21
-
|[_ATL_MULTI_THREADED](#_atl_multi_threaded)|A symbol that indicates the project will have objects that are marked as Both, Free or Neutral. The macro [_ATL_FREE_THREADED](#_atl_free_threaded) should be used instead.|
22
-
|[_ATL_NO_AUTOMATIC_NAMESPACE](#_atl_no_automatic_namespace)|A symbol that prevents the default use of namespace as ATL.|
23
-
|[_ATL_NO_COM_SUPPORT](#_atl_no_com_support)|A symbol that prevents COM-related code from being compiled with your project.|
24
-
|[ATL_NO_VTABLE](#atl_no_vtable)|A symbol that prevents the vtable pointer from being initialized in the class's constructor and destructor.|
25
-
|[ATL_NOINLINE](#atl_noinline)|A symbol that indicates a function shouldn't be inlined.|
26
-
|[_ATL_SINGLE_THREADED](#_atl_single_threaded)|Define if all of your objects use the single threading model.|
|[`_ATL_ALL_WARNINGS`](#_atl_all_warnings)|A symbol that enables errors in projects converted from previous versions of ATL.|
15
+
|[`_ATL_APARTMENT_THREADED`](#_atl_apartment_threaded)|Define if one or more of your objects use apartment threading.|
16
+
|[`_ATL_CSTRING_EXPLICIT_CONSTRUCTORS`](#_atl_cstring_explicit_constructors)|Makes certain `CString` constructors explicit, preventing any unintentional conversions.|
17
+
|[`_ATL_ENABLE_PTM_WARNING`](#_atl_enable_ptm_warning)|Define this macro to require C++ standard syntax. It generates the C4867 compiler error when non-standard syntax is used to initialize a pointer to a member function.|
18
+
|[`_ATL_FREE_THREADED`](#_atl_free_threaded)|Define if one or more of your objects use free or neutral threading.|
19
+
|[`_ATL_MODULES`](#_ATL_MODULES)|Allows you to compile ATL projects with [permissive-](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).|
20
+
|[`_ATL_MULTI_THREADED`](#_atl_multi_threaded)|A symbol that indicates the project will have objects that are marked as Both, Free or Neutral. The macro [`_ATL_FREE_THREADED`](#_atl_free_threaded) should be used instead.|
21
+
|[`_ATL_NO_AUTOMATIC_NAMESPACE`](#_atl_no_automatic_namespace)|A symbol that prevents the default use of namespace as ATL.|
22
+
|[`_ATL_NO_COM_SUPPORT`](#_atl_no_com_support)|A symbol that prevents COM-related code from being compiled with your project.|
23
+
|[`ATL_NO_VTABLE`](#atl_no_vtable)|A symbol that prevents the vtable pointer from being initialized in the class's constructor and destructor.|
24
+
|[`ATL_NOINLINE`](#atl_noinline)|A symbol that indicates a function shouldn't be inlined.|
25
+
|[`_ATL_SINGLE_THREADED`](#_atl_single_threaded)|Define if all of your objects use the single threading model.|
Define if one or more of your objects use apartment threading.
67
66
@@ -73,7 +72,7 @@ _ATL_APARTMENT_THREADED
73
72
74
73
Specifies apartment threading. For other options, and a description of the threading models available for an ATL object, see [Specifying the Project's Threading Model](../../atl/specifying-the-threading-model-for-a-project-atl.md) and [Options, ATL Simple Object Wizard](../../atl/reference/options-atl-simple-object-wizard.md).
When this constructor is defined, all CString constructors that take a single parameter are compiled with the explicit keyword, which prevents implicit conversions of input arguments. This means, for example, that when _UNICODE is defined, if you attempt to use a char* string as a CString constructor argument, a compiler error will result. Use this macro in situations where you need to prevent implicit conversions between narrow and wide string types.
87
86
88
-
By using the _T macro on all constructor string arguments, you can define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS and avoid compile errors regardless of whether _UNICODE is defined.
87
+
By using the `_T` macro on all constructor string arguments, you can define `_ATL_CSTRING_EXPLICIT_CONSTRUCTORS` and avoid compile errors regardless of whether `_UNICODE` is defined.
Define this macro in order to force the use of ANSI C++ standard-conforming syntax for pointer to member functions. Using this macro will cause the C4867 compiler error to be generated when non-standard syntax is used to initialize a pointer to a member function.
93
92
@@ -99,7 +98,7 @@ Define this macro in order to force the use of ANSI C++ standard-conforming synt
99
98
100
99
The ATL and MFC libraries have been changed to match the Microsoft C++ compiler's improved standard C++ conformance. According to the ANSI C++ standard, the syntax of a pointer to a class member function should be `&CMyClass::MyFunc`.
101
100
102
-
When [_ATL_ENABLE_PTM_WARNING](#_atl_enable_ptm_warning)is not defined (the default case), ATL/MFC disables the C4867 error in macro maps (notably message maps) so that code that was created in earlier versions can continue to build as before. If you define **_ATL_ENABLE_PTM_WARNING**, your code should conform to the C++ standard.
101
+
When [`_ATL_ENABLE_PTM_WARNING`](#_atl_enable_ptm_warning)isn't defined (the default case), ATL/MFC disables the C4867 error in macro maps (notably message maps) so that code that was created in earlier versions can continue to build as before. If you define `_ATL_ENABLE_PTM_WARNING`, your code should conform to the C++ standard.
103
102
104
103
However, the non-standard form has been deprecated. You need to move existing code to C++ standard syntax. For example, the following code:
105
104
@@ -111,7 +110,7 @@ Should be changed to:
111
110
112
111
For map macros, add the ampersand '&' character. You shouldn't add the character again in your code.
Define if one or more of your objects use free or neutral threading.
117
116
@@ -125,13 +124,13 @@ Specifies free threading. Free threading is equivalent to a multithread apartmen
125
124
126
125
## <aname="_ATL_MODULES"></a> `_ATLMODULES`
127
126
128
-
Allows you to compile ATL projects with [permissive-](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).
127
+
Allows you to compile ATL projects with [`permissive-`](../../build/reference/permissive-standards-conformance.md) and use ATL with [C++ modules](../../cpp/modules-cpp.md).
A symbol that indicates the project will have objects that are marked as Both, Free or Neutral.
137
136
@@ -141,9 +140,9 @@ _ATL_MULTI_THREADED
141
140
142
141
### Remarks
143
142
144
-
If this symbol is defined, ATL will pull in code that will correctly synchronize access to global data. New code should use the equivalent macro [_ATL_FREE_THREADED](#_atl_free_threaded) instead.
143
+
If this symbol is defined, ATL will pull in code that will correctly synchronize access to global data. New code should use the equivalent macro [`_ATL_FREE_THREADED`](#_atl_free_threaded) instead.
A symbol that prevents the default use of namespace as ATL.
149
148
@@ -153,17 +152,17 @@ _ATL_NO_AUTOMATIC_NAMESPACE
153
152
154
153
### Remarks
155
154
156
-
If this symbol is not defined, including atlbase.h will perform **using namespace ATL** by default, which may lead to naming conflicts. To prevent this, define this symbol.
155
+
If this symbol isn't defined, including `atlbase.h` will perform `using namespace ATL` by default, which may lead to naming conflicts. To prevent this, define this symbol.
A symbol that prevents COM-related code from being compiled with your project.
161
160
162
161
```
163
162
_ATL_NO_COM_SUPPORT
164
163
```
165
164
166
-
## <aname="atl_no_vtable"></a> ATL_NO_VTABLE
165
+
## <aname="atl_no_vtable"></a> `ATL_NO_VTABLE`
167
166
168
167
A symbol that prevents the vtable pointer from being initialized in the class's constructor and destructor.
169
168
@@ -173,13 +172,13 @@ ATL_NO_VTABLE
173
172
174
173
### Remarks
175
174
176
-
If the vtable pointer is prevented from being initialized in the class's constructor and destructor, the linker can eliminate the vtable and all of the functions to which it points. Expands to **`__declspec(novtable)`**.
175
+
If the vtable pointer is prevented from being initialized in the class's constructor and destructor, the linker can eliminate the vtable and all of the functions to which it points. Expands to `__declspec(novtable)`.
A symbol that indicates a function shouldn't be inlined.
185
184
@@ -193,14 +192,14 @@ A symbol that indicates a function shouldn't be inlined.
193
192
194
193
### Parameters
195
194
196
-
*myfunction*<br/>
195
+
*`myfunction`*\
197
196
The function that should not be inlined.
198
197
199
198
### Remarks
200
199
201
-
Use this symbol if you want to ensure a function does not get inlined by the compiler, even though it must be declared as inline so that it can be placed in a header file. Expands to **`__declspec(noinline)`**.
200
+
Use this symbol if you want to ensure a function does not get inlined by the compiler, even though it must be declared as inline so that it can be placed in a header file. Expands to `__declspec(noinline)`.
Copy file name to clipboardExpand all lines: docs/build/cmake-presets-vs.md
+16-9Lines changed: 16 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Configure and build with CMake Presets
3
3
description: "Reference for using CMake Presets to configure and build CMake projects."
4
-
ms.date: 09/13/2022
4
+
ms.date: 02/01/2023
5
5
ms.topic: reference
6
6
---
7
7
@@ -21,22 +21,29 @@ We recommend *`CMakePresets.json`* as an alternative to *`CMakeSettings.json`*.
21
21
22
22
## Supported CMake and *`CMakePresets.json`* versions
23
23
24
-
The supported *`CMakePresets.json`* and *`CMakeUserPresets.json`* schema versions depend on your version of Visual Studio. Visual Studio 2019 version 16.10 and later support schema versions 2 and 3. Visual Studio 2022 version 17.4 preview 2 adds support for schema versions 4 and 5. You can update the version by changing the `"version"` field in the root object. For an example and more information, see [`CMakePresets.json` format](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#format).
24
+
The supported *`CMakePresets.json`* and *`CMakeUserPresets.json`* schema versions depend on your version of Visual Studio:
25
+
- Visual Studio 2019 version 16.10 and later support schema versions 2 and 3.
26
+
- Visual Studio 2022 version 17.4 preview 2 adds support for schema versions 4 and 5.
25
27
26
-
CMake version 3.20 or later is required when you're invoking CMake with *`CMakePresets.json`* from the command line. However, Visual Studio reads and evaluates *`CMakePresets.json`* and *`CMakeUserPresets.json`* itself and doesn't invoke CMake directly with the `--preset` option. So, CMake version 3.20 or later isn't strictly required when you're building with *`CMakePresets.json`* inside Visual Studio. We recommend using at least CMake version 3.14 or later.
28
+
You can update the version by changing the `"version"` field in the root object. For an example and more information, see [`CMakePresets.json` format](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#format).
29
+
30
+
CMake version 3.20 or later is required when you're invoking CMake with *`CMakePresets.json`* from the command line. However, Visual Studio reads and evaluates *`CMakePresets.json`* and *`CMakeUserPresets.json`* itself and doesn't invoke CMake directly with the `--preset` option. So, CMake version 3.20 or later isn't strictly required when you're building with *`CMakePresets.json`* inside Visual Studio.
31
+
32
+
We recommend using at least CMake version 3.14 or later.
27
33
28
34
## <aname="enable-cmakepresets-json-integration"></a> Enable *`CMakePresets.json`* integration in Visual Studio
29
35
30
36
*`CMakePresets.json`* integration isn't enabled by default in Visual Studio. You can enable it in **Tools** > **Options** > **CMake** > **General**:
31
37
32
-

38
+
:::image type="content" source="./media/enable-cmakepresets-new.png" alt-text="Screenshot of the older Visual Studio enable CMakePresets.json checkbox. The checkbox reads: Always use CMakePresets.json.":::
33
39
34
40
> [!IMPORTANT]
35
41
> Close and reopen the folder in Visual Studio to activate the integration.
36
42
37
43
In some older versions of Visual Studio, **Tools** > **Options** > **CMake** > **General** only has a single option to enable *`CMakePresets.json`* integration:
38
44
39
-

45
+
:::image type="content" source="./media/enable-cmakepresets.png" alt-text="Screenshot of older Visual Studio enable CMakePresets.json checkbox which is labeled: Use C Make Presets .json to drive CMake configure, build, and test."
46
+
:::image-end:::
40
47
41
48
The following table indicates when *`CMakePresets.json`* is used instead of *`CMakeSettings.json`* to drive CMake configuration and build in Visual Studio 2022 and Visual Studio 2019 version 16.10 and later. If no configuration file is present, default Configure Presets are used.
42
49
@@ -110,15 +117,15 @@ If you try to open or modify a *`CMakePresets.json`* file that doesn't exist, Vi
110
117
111
118
## Configure and build
112
119
113
-
Visual Studio provides dropdown lists for the Target Systems, Configure Presets, and Build Presets when *`CMakePresets.json`* integration is enabled:
120
+
On the Visual Studio toolbar, there are dropdowns for the Target Systems, Configure Presets, and Build Presets when *`CMakePresets.json`* integration is enabled:
114
121
115
-

122
+
:::image type="content" source="./media/target-system-dropdown.png" alt-text="Screenshot showing the dropdowns for target system set to Local Machine, configuration set to windows-arm64, and build preset set to default.":::
116
123
117
124
### Select a Target System
118
125
119
126
The dropdown list on the left indicates the active *Target System*. It's the system on which CMake is invoked to configure and build the project. This dropdown list includes your local machine, all SSH connections in Connection Manager by host name, and all Windows Subsystem for Linux (WSL) installations that Visual Studio can find:
120
127
121
-

128
+
:::image type="content" source="./media/target-system-selections.png" alt-text="Screenshot of the Target System dropdown list which contains: Local Machine, 192.168.0.5, WSL: ubuntu2004, WSL: debian, and Manage Connections.":::
122
129
123
130
In the preceding example:
124
131
@@ -177,7 +184,7 @@ Use a forward slash (`/`) for paths in *`CMakePresets.json`* and *`CMakeUserPres
177
184
178
185
To add a new Configure Preset to *`CMakePresets.json`*, from **Solution Explorer**, right-click *`CMakePresets.json`* from **Folder View** and select **Add Configuration** from the shortcut menu. The dialog to select a Configure Preset template appears:
179
186
180
-

187
+
:::image type="content" source="./media/add-configure-preset-to-cmakepresets.png" alt-text="Screenshot of Visual Studio Add Configure Preset to the JSON file dialog. It contains entries such as Linux Debug, macOS Debug, x64 Debug, and more.":::
181
188
182
189
Select the **Windows x64 Debug** template to configure on Windows systems. Select the **Linux Debug** template to configure on WSL and remote Linux systems. For more information about editing *`CMakePresets.json`*, see [Edit presets](#edit-presets).
0 commit comments