summaryrefslogtreecommitdiffstats
path: root/Help/prop_tgt/C_STANDARD.rst
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/C_STANDARD.rst
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/C_STANDARD.rst')
-rw-r--r--Help/prop_tgt/C_STANDARD.rst27
1 files changed, 27 insertions, 0 deletions
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.