Merge topic 'target_compile_features'

9eaf3755 Export: Populate INTERFACE_COMPILE_FEATURES property.
8ed59fc2 Add target_compile_features command.
4e6ca504 cmTargetPropCommandBase: Change the interface to return bool.
5412dede cmTarget: Transitively evaluate compiler features.
baff4434 cmTarget: Allow populating COMPILE_FEATURES using generator expressions.
f97bf437 Features: Add cxx_auto_type.
03355d6b cmTarget: Add COMPILE_FEATURES target property.
faeddf64 project: Add infrastructure for recording CXX compiler features
913394af cmTarget: Add CXX_STANDARD and CXX_EXTENSION target properties.
8238a6cd Add some COMPILE_OPTIONS for specifying C++ dialect.
892243fc Tests: Require CMake 3.0 for the SystemInformation test.
59b5fdd3 Don't load Clang-CXX from AppleClang-CXX.
This commit is contained in:
Brad King
2014-04-15 10:32:11 -04:00
committed by CMake Topic Stage
118 changed files with 1209 additions and 21 deletions
+30
View File
@@ -0,0 +1,30 @@
target_compile_features
-----------------------
Add expected compiler features to a target.
::
target_compile_features(<target> <PRIVATE|PUBLIC|INTERFACE> <feature> [...])
Specify compiler features required when compiling a given target. If the
feature is not listed in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable,
then an error will be reported by CMake. If the use of the feature requires
an additional compiler flag, such as ``-std=c++11``, the flag will be added
automatically.
The ``INTERFACE``, ``PUBLIC`` and ``PRIVATE`` keywords are required to
specify the scope of the features. ``PRIVATE`` and ``PUBLIC`` items will
populate the :prop_tgt:`COMPILE_FEATURES` property of ``<target>``.
``PUBLIC`` and ``INTERFACE`` items will populate the
:prop_tgt:`INTERFACE_COMPILE_FEATURES` property of ``<target>``. Repeated
calls for the same ``<target>`` append items.
The named ``<target>`` must have been created by a command such as
:command:`add_executable` or :command:`add_library` and must not be
an ``IMPORTED`` target.
Arguments to ``target_compile_features`` may use "generator expressions"
with the syntax ``$<...>``.
See the :manual:`cmake-generator-expressions(7)` manual for available
expressions.
+1
View File
@@ -91,6 +91,7 @@ These commands may be used freely in CMake projects.
/command/source_group
/command/string
/command/target_compile_definitions
/command/target_compile_features
/command/target_compile_options
/command/target_include_directories
/command/target_link_libraries
+4
View File
@@ -98,6 +98,7 @@ Properties on Targets
/prop_tgt/COMPATIBLE_INTERFACE_STRING
/prop_tgt/COMPILE_DEFINITIONS_CONFIG
/prop_tgt/COMPILE_DEFINITIONS
/prop_tgt/COMPILE_FEATURES
/prop_tgt/COMPILE_FLAGS
/prop_tgt/COMPILE_OPTIONS
/prop_tgt/COMPILE_PDB_NAME
@@ -106,6 +107,8 @@ Properties on Targets
/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
/prop_tgt/CONFIG_OUTPUT_NAME
/prop_tgt/CONFIG_POSTFIX
/prop_tgt/CXX_STANDARD
/prop_tgt/CXX_EXTENSIONS
/prop_tgt/DEBUG_POSTFIX
/prop_tgt/DEFINE_SYMBOL
/prop_tgt/EchoString
@@ -148,6 +151,7 @@ Properties on Targets
/prop_tgt/INSTALL_RPATH_USE_LINK_PATH
/prop_tgt/INTERFACE_AUTOUIC_OPTIONS
/prop_tgt/INTERFACE_COMPILE_DEFINITIONS
/prop_tgt/INTERFACE_COMPILE_FEATURES
/prop_tgt/INTERFACE_COMPILE_OPTIONS
/prop_tgt/INTERFACE_INCLUDE_DIRECTORIES
/prop_tgt/INTERFACE_LINK_LIBRARIES
+4
View File
@@ -257,6 +257,10 @@ Variables for Languages
:maxdepth: 1
/variable/CMAKE_COMPILER_IS_GNULANG
/variable/CMAKE_CXX_COMPILE_FEATURES
/variable/CMAKE_CXX_KNOWN_FEATURES
/variable/CMAKE_CXX_STANDARD
/variable/CMAKE_CXX_EXTENSIONS
/variable/CMAKE_Fortran_MODDIR_DEFAULT
/variable/CMAKE_Fortran_MODDIR_FLAG
/variable/CMAKE_Fortran_MODOUT_FLAG
+11
View File
@@ -0,0 +1,11 @@
COMPILE_FEATURES
----------------
Compiler features enabled for this target.
The list of features in this property are a subset of the features listed
in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable.
Contents of ``COMPILE_FEATURES`` may use "generator expressions" with the
syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)` manual for
available expressions.
+8
View File
@@ -0,0 +1,8 @@
CXX_EXTENSIONS
--------------
Boolean specifying whether compiler specific extensions are requested.
This property specifies whether compiler specific extensions should be
used. For some compilers, this results in adding a flag such
as ``-std=gnu++11`` instead of ``-std=c++11`` to the compile line.
+14
View File
@@ -0,0 +1,14 @@
CXX_STANDARD
------------
The C++ standard whose features are required to build this target.
This property specifies the C++ standard whose features are required
to build this target. For some compilers, this results in adding a
flag such as ``-std=c++11`` to the compile line.
Supported values are ``98`` and ``11``.
This property is initialized by the value of
the :variable:`CMAKE_CXX_STANDARD` variable if it is set when a target
is created.
@@ -0,0 +1,14 @@
INTERFACE_COMPILE_FEATURES
--------------------------
List of public compile requirements for a library.
Targets may populate this property to publish the compiler features
required to compile against the headers for the target. Consuming
targets can add entries to their own :prop_tgt:`COMPILE_FEATURES`
property such as ``$<TARGET_PROPERTY:foo,INTERFACE_COMPILE_FEATURES>``
to require the features specified in the interface of ``foo``.
Contents of ``INTERFACE_COMPILE_FEATURES`` may use "generator expressions"
with the syntax ``$<...>``. See the :manual:`cmake-generator-expressions(7)`
manual for available expressions.
@@ -0,0 +1,18 @@
target-language-features
------------------------
* New :prop_tgt:`CXX_STANDARD` and :prop_tgt:`CXX_EXTENSIONS` target
properties may specify values which CMake uses to compute required
compile options such as ``-std=c++11`` or ``-std=gnu++11``. The
:variable:`CMAKE_CXX_STANDARD` and :variable:`CMAKE_CXX_EXTENSIONS`
variables may be set to initialize the target properties.
* New :prop_tgt:`COMPILE_FEATURES` target property may contain a list
of features required to compile a target. CMake uses this
information to ensure that the compiler in use is capable of building
the target, and to add any necessary compile flags to support language
features.
* New :command:`target_compile_features` command allows populating the
:prop_tgt:`COMPILE_FEATURES` target property, just like any other
build variable.
@@ -0,0 +1,8 @@
CMAKE_CXX_COMPILE_FEATURES
--------------------------
List of features known to the C++ compiler
These features are known to be available for use with the C++ compiler. This
list is a subset of the features listed in the :variable:`CMAKE_CXX_KNOWN_FEATURES`
variable.
+8
View File
@@ -0,0 +1,8 @@
CMAKE_CXX_EXTENSIONS
--------------------
Default value for ``CXX_EXTENSIONS`` property of targets.
This variable is used to initialize the :prop_tgt:`CXX_EXTENSIONS`
property on all targets. See that target property for additional
information.
@@ -0,0 +1,18 @@
CMAKE_CXX_KNOWN_FEATURES
------------------------
List of C++ features known to this version of CMake.
The features listed in this variable may be known to be available to the
C++ compiler. If the feature is available with the C++ compiler, it will
be listed in the :variable:`CMAKE_CXX_COMPILE_FEATURES` variable.
The features listed here may be used with the :command:`target_compile_features`
command.
The features known to this version of CMake are:
``cxx_auto_type``
Automatic type deduction, as defined in N1984_.
.. _N1984: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf
+8
View File
@@ -0,0 +1,8 @@
CMAKE_CXX_STANDARD
------------------
Default value for ``CXX_STANDARD`` property of targets.
This variable is used to initialize the :prop_tgt:`CXX_STANDARD`
property on all targets. See that target property for additional
information.
@@ -7,7 +7,7 @@ This variable can be populated with a list of properties to generate
debug output for when evaluating target properties. Currently it can
only be used when evaluating the :prop_tgt:`INCLUDE_DIRECTORIES`,
:prop_tgt:`COMPILE_DEFINITIONS`, :prop_tgt:`COMPILE_OPTIONS`,
:prop_tgt:`AUTOUIC_OPTIONS`, :prop_tgt:`SOURCES`,
:prop_tgt:`AUTOUIC_OPTIONS`, :prop_tgt:`SOURCES`, :prop_tgt:`COMPILE_FEATURES`,
:prop_tgt:`POSITION_INDEPENDENT_CODE` target properties and any other property
listed in :prop_tgt:`COMPATIBLE_INTERFACE_STRING` and other ``COMPATIBLE_INTERFACE_``
properties. It outputs an origin for each entry in the target property.