]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: cosmetic changes
authorMatthias Maier <tamiko@43-1.org>
Sun, 6 May 2018 16:39:55 +0000 (11:39 -0500)
committerMatthias Maier <tamiko@43-1.org>
Sun, 6 May 2018 21:43:58 +0000 (16:43 -0500)
cmake/checks/check_01_cxx_features.cmake

index 36e231d9705483c95f7a7ba1a8183f6096f4f5e4..827766a8fa83bbe96e9e66a21948cd3740ac2121 100644 (file)
 #                                                                      #
 ########################################################################
 
+
+#
+#                              BIG DISCLAIMER
+#
+# Frankly speaking - this whole file is a mess and has to be rewritten and
+# restructured at some point. So, if you are the lucky one who wants to add
+# DEAL_II_WITH_CXX2X support, do not add yet another 300 lines of spaghetti
+# code but restructure the whole thing to something sane.
+#
+
+
 #
 IF(DEAL_II_WITH_CXX17 AND DEFINED DEAL_II_WITH_CXX14 AND NOT DEAL_II_WITH_CXX14)
   MESSAGE(FATAL_ERROR
@@ -456,6 +467,13 @@ ELSE()
     "DEAL_II_WITH_CXX17 and DEAL_II_WITH_CXX14 are both disabled")
 ENDIF()
 
+
+########################################################################
+#                                                                      #
+#                   Check for various C++ features:                    #
+#                                                                      #
+########################################################################
+
 #
 # Try to enable a fallthrough attribute. This is a language feature in C++17,
 # but a compiler extension in earlier language versions: check both
@@ -497,14 +515,8 @@ ELSE()
   ENDIF()
 ENDIF()
 
-
-########################################################################
-#                                                                      #
-#                   Check for various C++ features:                    #
-#                                                                      #
-########################################################################
-
 PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}")
+
 CHECK_CXX_SOURCE_COMPILES(
   "
   #include <type_traits>
@@ -512,7 +524,6 @@ CHECK_CXX_SOURCE_COMPILES(
   "
   DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE)
 
-
 #
 # Check that we can use feenableexcept through the C++11 header file cfenv:
 #
@@ -522,9 +533,7 @@ CHECK_CXX_SOURCE_COMPILES(
 #
 # - Timo Heister, 2015
 #
-
-IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
-  CHECK_CXX_SOURCE_RUNS(
+SET(_snippet
     "
     #include <cfenv>
     #include <limits>
@@ -541,30 +550,15 @@ IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
       return 0;
     }
     "
-    DEAL_II_HAVE_FP_EXCEPTIONS)
+    )
+IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION)
+  CHECK_CXX_SOURCE_RUNS("${_snippet}" DEAL_II_HAVE_FP_EXCEPTIONS)
 ELSE()
   #
   # If we are not allowed to do platform introspection, just test whether
   # we can compile above code.
   #
-  CHECK_CXX_SOURCE_COMPILES(
-    "
-    #include <cfenv>
-    #include <limits>
-    #include <sstream>
-
-    int main()
-    {
-      feenableexcept(FE_DIVBYZERO|FE_INVALID);
-      std::ostringstream description;
-      const double lower_bound = -std::numeric_limits<double>::max();
-
-      description << lower_bound;
-
-      return 0;
-    }
-    "
-    DEAL_II_HAVE_FP_EXCEPTIONS)
+  CHECK_CXX_SOURCE_COMPILES("${_snippet}" DEAL_II_HAVE_FP_EXCEPTIONS)
 ENDIF()
 
 #
@@ -590,4 +584,5 @@ CHECK_CXX_SOURCE_COMPILES(
   }
   "
   DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS)
+
 RESET_CMAKE_REQUIRED()

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.