summaryrefslogtreecommitdiffstats
path: root/Help/prop_tgt
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-11-04 00:15:43 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-05-14 22:15:18 (GMT)
commite0890d03a48d12904ffe24aa94fb2847d8d5f4e7 (patch)
tree820631dcc5cd8c95111dbfa7d33e1a59d554f8a4 /Help/prop_tgt
parent775458dede98d28fe81ac878541a6ead735443fc (diff)
downloadCMake-e0890d03a48d12904ffe24aa94fb2847d8d5f4e7.zip
CMake-e0890d03a48d12904ffe24aa94fb2847d8d5f4e7.tar.gz
CMake-e0890d03a48d12904ffe24aa94fb2847d8d5f4e7.tar.bz2
Features: Extend concept to C language.
Add properties and variables corresponding to CXX equivalents. Add features for c_function_prototypes (C90), c_restrict (C99), c_variadic_macros (C99) and c_static_assert (C11). This feature set can be extended later. Add a <PREFIX>_RESTRICT symbol define to WriteCompilerDetectionHeader to conditionally represent the c_restrict feature.
Diffstat (limited to 'Help/prop_tgt')
-rw-r--r--Help/prop_tgt/C_EXTENSIONS.rst8
-rw-r--r--Help/prop_tgt/C_STANDARD.rst27
-rw-r--r--Help/prop_tgt/C_STANDARD_REQUIRED.rst14
3 files changed, 49 insertions, 0 deletions
diff --git a/Help/prop_tgt/C_EXTENSIONS.rst b/Help/prop_tgt/C_EXTENSIONS.rst
new file mode 100644
index 0000000..246e93d
--- /dev/null
+++ b/Help/prop_tgt/C_EXTENSIONS.rst
@@ -0,0 +1,8 @@
+C_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=gnu11`` instead of ``-std=c11`` to the compile line.
diff --git a/Help/prop_tgt/C_STANDARD.rst b/Help/prop_tgt/C_STANDARD.rst
new file mode 100644
index 0000000..9fdc0bb
--- /dev/null
+++ b/Help/prop_tgt/C_STANDARD.rst
@@ -0,0 +1,27 @@
+C_STANDARD
+----------
+
+The C standard whose features are requested to build this target.
+
+This property specifies the C standard whose features are requested
+to build this target. For some compilers, this results in adding a
+flag such as ``-std=c11`` to the compile line.
+
+Supported values are ``90``, ``99`` and ``11``.
+
+If the value requested does not result in a compile flag being added for
+the compiler in use, a previous standard flag will be added instead. This
+means that using:
+
+.. code-block:: cmake
+
+ set_property(TARGET tgt PROPERTY C_STANDARD 11)
+
+with a compiler which does not support ``-std=c11`` or an equivalent
+flag will not result in an error or warning, but will instead add the
+``-std=c99`` or ``-std=c90`` flag if supported. This "decay" behavior may
+be controlled with the :prop_tgt:`C_STANDARD_REQUIRED` target property.
+
+This property is initialized by the value of
+the :variable:`CMAKE_C_STANDARD` variable if it is set when a target
+is created.
diff --git a/Help/prop_tgt/C_STANDARD_REQUIRED.rst b/Help/prop_tgt/C_STANDARD_REQUIRED.rst
new file mode 100644
index 0000000..6c39e96
--- /dev/null
+++ b/Help/prop_tgt/C_STANDARD_REQUIRED.rst
@@ -0,0 +1,14 @@
+C_STANDARD_REQUIRED
+-------------------
+
+Boolean describing whether the value of :prop_tgt:`C_STANDARD` is a requirement.
+
+If this property is set to ``ON``, then the value of the
+:prop_tgt:`C_STANDARD` target property is treated as a requirement. If this
+property is ``OFF`` or unset, the :prop_tgt:`C_STANDARD` target property is
+treated as optional and may "decay" to a previous standard if the requested is
+not available.
+
+This property is initialized by the value of
+the :variable:`CMAKE_C_STANDARD_REQUIRED` variable if it is set when a
+target is created.