Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Help / prop_gbl / CMAKE_CXX_KNOWN_FEATURES.rst
1 CMAKE_CXX_KNOWN_FEATURES
2 ------------------------
3
4 .. versionadded:: 3.1
5
6 List of C++ features known to this version of CMake.
7
8 The features listed in this global property may be known to be available to the
9 C++ compiler.  If the feature is available with the C++ compiler, it will
10 be listed in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable.
11
12 The features listed here may be used with the :command:`target_compile_features`
13 command.  See the :manual:`cmake-compile-features(7)` manual for information on
14 compile features and a list of supported compilers.
15
16 The features known to this version of CMake are listed below.
17
18 High level meta features indicating C++ standard support
19 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20
21 .. versionadded:: 3.8
22
23 The following meta features indicate general support for the associated
24 language standard.  It reflects the language support claimed by the compiler,
25 but it does not necessarily imply complete conformance to that standard.
26
27 ``cxx_std_98``
28   Compiler mode is at least C++ 98.
29
30 ``cxx_std_11``
31   Compiler mode is at least C++ 11.
32
33 ``cxx_std_14``
34   Compiler mode is at least C++ 14.
35
36 ``cxx_std_17``
37   Compiler mode is at least C++ 17.
38
39 ``cxx_std_20``
40   .. versionadded:: 3.12
41
42   Compiler mode is at least C++ 20.
43
44 ``cxx_std_23``
45   .. versionadded:: 3.20
46
47   Compiler mode is at least C++ 23.
48
49 ``cxx_std_26``
50   .. versionadded:: 3.25
51
52   Compiler mode is at least C++ 26.
53
54 .. include:: CMAKE_LANG_STD_FLAGS.txt
55
56 Low level individual compile features
57 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
58
59 For C++ 11 and C++ 14, compilers were sometimes slow to implement certain
60 language features.  CMake provided some individual compile features to help
61 projects determine whether specific features were available.  These individual
62 features are now less relevant and projects should generally prefer to use the
63 high level meta features instead.  Individual compile features are not provided
64 for C++ 17 or later.
65
66 See the :manual:`cmake-compile-features(7)` manual for further discussion of
67 the use of individual compile features.
68
69 Individual features from C++ 98
70 """""""""""""""""""""""""""""""
71
72 ``cxx_template_template_parameters``
73   Template template parameters, as defined in ``ISO/IEC 14882:1998``.
74
75
76 Individual features from C++ 11
77 """""""""""""""""""""""""""""""
78
79 ``cxx_alias_templates``
80   Template aliases, as defined in N2258_.
81
82   .. _N2258: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2258.pdf
83
84 ``cxx_alignas``
85   Alignment control ``alignas``, as defined in N2341_.
86
87   .. _N2341: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf
88
89 ``cxx_alignof``
90   Alignment control ``alignof``, as defined in N2341_.
91
92   .. _N2341: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2341.pdf
93
94 ``cxx_attributes``
95   Generic attributes, as defined in N2761_.
96
97   .. _N2761: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2761.pdf
98
99 ``cxx_auto_type``
100   Automatic type deduction, as defined in N1984_.
101
102   .. _N1984: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf
103
104 ``cxx_constexpr``
105   Constant expressions, as defined in N2235_.
106
107   .. _N2235: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf
108
109
110 ``cxx_decltype_incomplete_return_types``
111   Decltype on incomplete return types, as defined in N3276_.
112
113   .. _N3276 : https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3276.pdf
114
115 ``cxx_decltype``
116   Decltype, as defined in N2343_.
117
118   .. _N2343: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2343.pdf
119
120 ``cxx_default_function_template_args``
121   Default template arguments for function templates, as defined in DR226_
122
123   .. _DR226: https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#226
124
125 ``cxx_defaulted_functions``
126   Defaulted functions, as defined in N2346_.
127
128   .. _N2346: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm
129
130 ``cxx_defaulted_move_initializers``
131   Defaulted move initializers, as defined in N3053_.
132
133   .. _N3053: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3053.html
134
135 ``cxx_delegating_constructors``
136   Delegating constructors, as defined in N1986_.
137
138   .. _N1986: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf
139
140 ``cxx_deleted_functions``
141   Deleted functions, as defined in N2346_.
142
143   .. _N2346: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2346.htm
144
145 ``cxx_enum_forward_declarations``
146   Enum forward declarations, as defined in N2764_.
147
148   .. _N2764: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2764.pdf
149
150 ``cxx_explicit_conversions``
151   Explicit conversion operators, as defined in N2437_.
152
153   .. _N2437: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2437.pdf
154
155 ``cxx_extended_friend_declarations``
156   Extended friend declarations, as defined in N1791_.
157
158   .. _N1791: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1791.pdf
159
160 ``cxx_extern_templates``
161   Extern templates, as defined in N1987_.
162
163   .. _N1987: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1987.htm
164
165 ``cxx_final``
166   Override control ``final`` keyword, as defined in N2928_, N3206_ and N3272_.
167
168   .. _N2928: https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm
169   .. _N3206: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm
170   .. _N3272: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm
171
172 ``cxx_func_identifier``
173   Predefined ``__func__`` identifier, as defined in N2340_.
174
175   .. _N2340: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2340.htm
176
177 ``cxx_generalized_initializers``
178   Initializer lists, as defined in N2672_.
179
180   .. _N2672: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2672.htm
181
182 ``cxx_inheriting_constructors``
183   Inheriting constructors, as defined in N2540_.
184
185   .. _N2540: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2540.htm
186
187 ``cxx_inline_namespaces``
188   Inline namespaces, as defined in N2535_.
189
190   .. _N2535: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2535.htm
191
192 ``cxx_lambdas``
193   Lambda functions, as defined in N2927_.
194
195   .. _N2927: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2927.pdf
196
197 ``cxx_local_type_template_args``
198   Local and unnamed types as template arguments, as defined in N2657_.
199
200   .. _N2657: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2657.htm
201
202 ``cxx_long_long_type``
203   ``long long`` type, as defined in N1811_.
204
205   .. _N1811: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf
206
207 ``cxx_noexcept``
208   Exception specifications, as defined in N3050_.
209
210   .. _N3050: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3050.html
211
212 ``cxx_nonstatic_member_init``
213   Non-static data member initialization, as defined in N2756_.
214
215   .. _N2756: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2756.htm
216
217 ``cxx_nullptr``
218   Null pointer, as defined in N2431_.
219
220   .. _N2431: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2431.pdf
221
222 ``cxx_override``
223   Override control ``override`` keyword, as defined in N2928_, N3206_
224   and N3272_.
225
226   .. _N2928: https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2009/n2928.htm
227   .. _N3206: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3206.htm
228   .. _N3272: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3272.htm
229
230 ``cxx_range_for``
231   Range-based for, as defined in N2930_.
232
233   .. _N2930: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2009/n2930.html
234
235 ``cxx_raw_string_literals``
236   Raw string literals, as defined in N2442_.
237
238   .. _N2442: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm
239
240 ``cxx_reference_qualified_functions``
241   Reference qualified functions, as defined in N2439_.
242
243   .. _N2439: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm
244
245 ``cxx_right_angle_brackets``
246   Right angle bracket parsing, as defined in N1757_.
247
248   .. _N1757: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1757.html
249
250 ``cxx_rvalue_references``
251   R-value references, as defined in N2118_.
252
253   .. _N2118: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html
254
255 ``cxx_sizeof_member``
256   Size of non-static data members, as defined in N2253_.
257
258   .. _N2253: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2253.html
259
260 ``cxx_static_assert``
261   Static assert, as defined in N1720_.
262
263   .. _N1720: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html
264
265 ``cxx_strong_enums``
266   Strongly typed enums, as defined in N2347_.
267
268   .. _N2347: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf
269
270 ``cxx_thread_local``
271   Thread-local variables, as defined in N2659_.
272
273   .. _N2659: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2659.htm
274
275 ``cxx_trailing_return_types``
276   Automatic function return type, as defined in N2541_.
277
278   .. _N2541: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2541.htm
279
280 ``cxx_unicode_literals``
281   Unicode string literals, as defined in N2442_.
282
283   .. _N2442: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2442.htm
284
285 ``cxx_uniform_initialization``
286   Uniform initialization, as defined in N2640_.
287
288   .. _N2640: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2640.pdf
289
290 ``cxx_unrestricted_unions``
291   Unrestricted unions, as defined in N2544_.
292
293   .. _N2544: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2544.pdf
294
295 ``cxx_user_literals``
296   User-defined literals, as defined in N2765_.
297
298   .. _N2765: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2765.pdf
299
300 ``cxx_variadic_macros``
301   Variadic macros, as defined in N1653_.
302
303   .. _N1653: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1653.htm
304
305 ``cxx_variadic_templates``
306   Variadic templates, as defined in N2242_.
307
308   .. _N2242: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2242.pdf
309
310
311 Individual features from C++ 14
312 """""""""""""""""""""""""""""""
313
314 ``cxx_aggregate_default_initializers``
315   Aggregate default initializers, as defined in N3605_.
316
317   .. _N3605: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3605.html
318
319 ``cxx_attribute_deprecated``
320   ``[[deprecated]]`` attribute, as defined in N3760_.
321
322   .. _N3760: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3760.html
323
324 ``cxx_binary_literals``
325   Binary literals, as defined in N3472_.
326
327   .. _N3472: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3472.pdf
328
329 ``cxx_contextual_conversions``
330   Contextual conversions, as defined in N3323_.
331
332   .. _N3323: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3323.pdf
333
334 ``cxx_decltype_auto``
335   ``decltype(auto)`` semantics, as defined in N3638_.
336
337   .. _N3638: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3638.html
338
339 ``cxx_digit_separators``
340   Digit separators, as defined in N3781_.
341
342   .. _N3781: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3781.pdf
343
344 ``cxx_generic_lambdas``
345   Generic lambdas, as defined in N3649_.
346
347   .. _N3649: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3649.html
348
349 ``cxx_lambda_init_captures``
350   Initialized lambda captures, as defined in N3648_.
351
352   .. _N3648: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3648.html
353
354 ``cxx_relaxed_constexpr``
355   Relaxed constexpr, as defined in N3652_.
356
357   .. _N3652: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3652.html
358
359 ``cxx_return_type_deduction``
360   Return type deduction on normal functions, as defined in N3386_.
361
362   .. _N3386: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3386.html
363
364 ``cxx_variable_templates``
365   Variable templates, as defined in N3651_.
366
367   .. _N3651: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3651.pdf