mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-12 09:08:58 -05:00
Help: Clarify what 'aware' means as it relates to C++ standards
This commit is contained in:
@@ -90,21 +90,21 @@ Requiring Language Standards
|
|||||||
In projects that use a large number of commonly available features from
|
In projects that use a large number of commonly available features from
|
||||||
a particular language standard (e.g. C++ 11) one may specify a
|
a particular language standard (e.g. C++ 11) one may specify a
|
||||||
meta-feature (e.g. ``cxx_std_11``) that requires use of a compiler mode
|
meta-feature (e.g. ``cxx_std_11``) that requires use of a compiler mode
|
||||||
aware of that standard. This is simpler than specifying all the
|
that is at minimum aware of that standard, but could be greater.
|
||||||
features individually, but does not guarantee the existence of any
|
This is simpler than specifying all the features individually, but does
|
||||||
particular feature. Diagnosis of use of unsupported features will be
|
not guarantee the existence of any particular feature.
|
||||||
delayed until compile time.
|
Diagnosis of use of unsupported features will be delayed until compile time.
|
||||||
|
|
||||||
For example, if C++ 11 features are used extensively in a project's
|
For example, if C++ 11 features are used extensively in a project's
|
||||||
header files, then clients must use a compiler mode aware of C++ 11
|
header files, then clients must use a compiler mode that is no less
|
||||||
or above. This can be requested with the code:
|
than C++ 11. This can be requested with the code:
|
||||||
|
|
||||||
.. code-block:: cmake
|
.. code-block:: cmake
|
||||||
|
|
||||||
target_compile_features(mylib PUBLIC cxx_std_11)
|
target_compile_features(mylib PUBLIC cxx_std_11)
|
||||||
|
|
||||||
In this example, CMake will ensure the compiler is invoked in a mode
|
In this example, CMake will ensure the compiler is invoked in a mode
|
||||||
that is aware of C++ 11 (or above), adding flags such as
|
of at-least C++ 11 (or C++ 14, C++ 17, ...), adding flags such as
|
||||||
``-std=gnu++11`` if necessary. This applies to sources within ``mylib``
|
``-std=gnu++11`` if necessary. This applies to sources within ``mylib``
|
||||||
as well as any dependents (that may include headers from ``mylib``).
|
as well as any dependents (that may include headers from ``mylib``).
|
||||||
|
|
||||||
|
|||||||
@@ -15,19 +15,19 @@ compile features and a list of supported compilers.
|
|||||||
The features known to this version of CMake are:
|
The features known to this version of CMake are:
|
||||||
|
|
||||||
``cxx_std_98``
|
``cxx_std_98``
|
||||||
Compiler mode is aware of C++ 98.
|
Compiler mode is at least C++ 98.
|
||||||
|
|
||||||
``cxx_std_11``
|
``cxx_std_11``
|
||||||
Compiler mode is aware of C++ 11.
|
Compiler mode is at least C++ 11.
|
||||||
|
|
||||||
``cxx_std_14``
|
``cxx_std_14``
|
||||||
Compiler mode is aware of C++ 14.
|
Compiler mode is at least C++ 14.
|
||||||
|
|
||||||
``cxx_std_17``
|
``cxx_std_17``
|
||||||
Compiler mode is aware of C++ 17.
|
Compiler mode is at least C++ 17.
|
||||||
|
|
||||||
``cxx_std_20``
|
``cxx_std_20``
|
||||||
Compiler mode is aware of C++ 20.
|
Compiler mode is at least C++ 20.
|
||||||
|
|
||||||
``cxx_aggregate_default_initializers``
|
``cxx_aggregate_default_initializers``
|
||||||
Aggregate default initializers, as defined in N3605_.
|
Aggregate default initializers, as defined in N3605_.
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ compile features and a list of supported compilers.
|
|||||||
The features known to this version of CMake are:
|
The features known to this version of CMake are:
|
||||||
|
|
||||||
``c_std_90``
|
``c_std_90``
|
||||||
Compiler mode is aware of C 90.
|
Compiler mode is at least C 90.
|
||||||
|
|
||||||
``c_std_99``
|
``c_std_99``
|
||||||
Compiler mode is aware of C 99.
|
Compiler mode is at least C 99.
|
||||||
|
|
||||||
``c_std_11``
|
``c_std_11``
|
||||||
Compiler mode is aware of C 11.
|
Compiler mode is at least C 11.
|
||||||
|
|
||||||
``c_function_prototypes``
|
``c_function_prototypes``
|
||||||
Function prototypes, as defined in ``ISO/IEC 9899:1990``.
|
Function prototypes, as defined in ``ISO/IEC 9899:1990``.
|
||||||
|
|||||||
Reference in New Issue
Block a user