summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-03-18 11:53:01 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-04-08 09:05:54 (GMT)
commit91289312fa9da0807b5c59a78de2c5ad21d6cda1 (patch)
tree0ab65d9f39964c899414ae5f08c54fe829206fdc
parent10f33eee1dfefa9e5a2ee5cf4946095bf08b19bc (diff)
downloadCMake-91289312fa9da0807b5c59a78de2c5ad21d6cda1.zip
CMake-91289312fa9da0807b5c59a78de2c5ad21d6cda1.tar.gz
CMake-91289312fa9da0807b5c59a78de2c5ad21d6cda1.tar.bz2
Features: Add cxx_constexpr.
-rw-r--r--Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst5
-rw-r--r--Modules/Compiler/GNU-CXX-FeatureTests.cmake3
-rw-r--r--Source/cmMakefile.cxx1
-rw-r--r--Tests/CompileFeatures/cxx_constexpr.cpp5
4 files changed, 14 insertions, 0 deletions
diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst
index b6b2b35..aa314cd 100644
--- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst
+++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst
@@ -17,6 +17,11 @@ The features known to this version of CMake are:
.. _N1984: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1984.pdf
+``cxx_constexpr``
+ Constant expressions, as defined in N2235_.
+
+ .. _N2235: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2235.pdf
+
``cxx_delegating_constructors``
Delegating constructors, as defined in N1986_.
diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
index 6baa463..5321eda 100644
--- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake
+++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake
@@ -10,6 +10,9 @@ set(_cmake_feature_test_cxx_delegating_constructors "${GNU47_CXX11}")
# support -std=c++11. Prior to that, support for C++11 features is technically
# experiemental and possibly incomplete (see for example the note below about
# cxx_variadic_template_template_parameters)
+# TODO: Should be supported by GNU 4.6
+set(GNU46_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
+set(_cmake_feature_test_cxx_constexpr "${GNU46_CXX11}")
# TODO: Should be supported by GNU 4.4
set(GNU44_CXX11 "${_oldestSupported} && __cplusplus >= 201103L")
set(_cmake_feature_test_cxx_auto_type "${GNU44_CXX11}")
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 52f4fb6..cc1dfa1 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -43,6 +43,7 @@
#define FOR_EACH_CXX_FEATURE(F) \
F(cxx_auto_type) \
+ F(cxx_constexpr) \
F(cxx_delegating_constructors) \
F(cxx_variadic_templates)
diff --git a/Tests/CompileFeatures/cxx_constexpr.cpp b/Tests/CompileFeatures/cxx_constexpr.cpp
new file mode 100644
index 0000000..570c10f
--- /dev/null
+++ b/Tests/CompileFeatures/cxx_constexpr.cpp
@@ -0,0 +1,5 @@
+
+constexpr int getNum()
+{
+ return 42;
+}