From 88542a61011d13ed0a92b9a1da49d428846aaf20 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 4 Apr 2014 00:00:28 +0200 Subject: [PATCH] Features: Add cxx_static_assert. --- Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst | 5 +++++ Modules/Compiler/GNU-CXX-FeatureTests.cmake | 3 +++ Source/cmMakefile.cxx | 1 + Tests/CompileFeatures/cxx_static_assert.cpp | 2 ++ 4 files changed, 11 insertions(+) create mode 100644 Tests/CompileFeatures/cxx_static_assert.cpp diff --git a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst index aa314cdb4..042cd434f 100644 --- a/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst +++ b/Help/variable/CMAKE_CXX_KNOWN_FEATURES.rst @@ -27,6 +27,11 @@ The features known to this version of CMake are: .. _N1986: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf +``cxx_static_assert`` + Static assert, as defined in N1720_. + + .. _N1720: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1720.html + ``cxx_variadic_templates`` Variadic templates, as defined in N2242_. diff --git a/Modules/Compiler/GNU-CXX-FeatureTests.cmake b/Modules/Compiler/GNU-CXX-FeatureTests.cmake index 5321eda33..5d6165660 100644 --- a/Modules/Compiler/GNU-CXX-FeatureTests.cmake +++ b/Modules/Compiler/GNU-CXX-FeatureTests.cmake @@ -24,4 +24,7 @@ set(_cmake_feature_test_cxx_variadic_templates "${GNU44_CXX11}") # 'completes' it, so that is the version we record as having the variadic # templates capability in CMake. See # http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2555.pdf +# TODO: Should be supported by GNU 4.3 +set(GNU43_CXX11 "${_oldestSupported} && __cplusplus >= 201103L") +set(_cmake_feature_test_cxx_static_assert "${GNU43_CXX11}") set(_oldestSupported) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index cc1dfa1ad..fa806a71d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -45,6 +45,7 @@ F(cxx_auto_type) \ F(cxx_constexpr) \ F(cxx_delegating_constructors) \ + F(cxx_static_assert) \ F(cxx_variadic_templates) class cmMakefile::Internals diff --git a/Tests/CompileFeatures/cxx_static_assert.cpp b/Tests/CompileFeatures/cxx_static_assert.cpp new file mode 100644 index 000000000..6aa8678f6 --- /dev/null +++ b/Tests/CompileFeatures/cxx_static_assert.cpp @@ -0,0 +1,2 @@ + +static_assert(true, "static_assert test");