]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: In case of C++14 support, check whether std::max/min support constexpr 4787/head
authorMatthias Maier <tamiko@43-1.org>
Sat, 12 Aug 2017 16:37:41 +0000 (11:37 -0500)
committerMatthias Maier <tamiko@43-1.org>
Sat, 12 Aug 2017 18:19:46 +0000 (13:19 -0500)
cmake/checks/check_01_cxx_features.cmake

index d1dc5b79148456ac7dadf987bd0c0e08745c49d5..877438eaf4cba1bafea5c7e95fe48a14995aa72b 100644 (file)
@@ -49,6 +49,7 @@ IF(DEFINED DEAL_II_WITH_CXX14 AND NOT DEAL_II_WITH_CXX14)
   SET(DEAL_II_WITH_CXX17 OFF CACHE STRING "" FORCE)
 ENDIF()
 
+#
 # Check the user supplied DEAL_II_CXX_VERSION_FLAG
 #
 
@@ -183,6 +184,22 @@ IF(NOT DEFINED DEAL_II_WITH_CXX14 OR DEAL_II_WITH_CXX14)
       "
       DEAL_II_HAVE_CXX14_MAKE_UNIQUE)
 
+    #
+    # This test checks constexpr std::max/min support. Unfortunately,
+    # gcc-4.9 does claim to support C++14 but fails to provide a constexpr
+    # compatible std::max/min. Disable C++14 support in this case.
+    #
+    CHECK_CXX_SOURCE_COMPILES(
+      "
+      #include <algorithm>
+      int main()
+      {
+          constexpr int max = std::max(0,1);
+      }
+      "
+      DEAL_II_HAVE_CXX14_CONSTEXPR_STDMAXMIN)
+
+
     #
     # Clang-3.5* or older, bail out with a spurious error message in case
     # of an undeduced auto return type.
@@ -207,7 +224,8 @@ IF(NOT DEFINED DEAL_II_WITH_CXX14 OR DEAL_II_WITH_CXX14)
   ENDIF()
 
   IF( DEAL_II_HAVE_CXX14_MAKE_UNIQUE AND
-      DEAL_II_HAVE_CXX14_CLANGAUTODEBUG_BUG_OK )
+      DEAL_II_HAVE_CXX14_CLANGAUTODEBUG_BUG_OK AND
+      DEAL_II_HAVE_CXX14_CONSTEXPR_STDMAXMIN)
     SET(DEAL_II_HAVE_CXX14 TRUE)
   ELSE()
     IF(NOT _user_provided_cxx_version_flag)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.