From: Matthias Maier Date: Sun, 6 May 2018 16:39:55 +0000 (-0500) Subject: CMake: cosmetic changes X-Git-Tag: v9.1.0-rc1~1201^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc5385de2479892af536ae6adbd66282e3234f89;p=dealii.git CMake: cosmetic changes --- diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index ccc50ab2f3..842bb034b8 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -35,6 +35,17 @@ # # ######################################################################## + +# +# 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 @@ -459,6 +470,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 @@ -500,14 +518,8 @@ ELSE() ENDIF() ENDIF() - -######################################################################## -# # -# Check for various C++ features: # -# # -######################################################################## - PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") + CHECK_CXX_SOURCE_COMPILES( " #include @@ -515,7 +527,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: # @@ -525,9 +536,7 @@ CHECK_CXX_SOURCE_COMPILES( # # - Timo Heister, 2015 # - -IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) - CHECK_CXX_SOURCE_RUNS( +SET(_snippet " #include #include @@ -544,30 +553,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 - #include - #include - - int main() - { - feenableexcept(FE_DIVBYZERO|FE_INVALID); - std::ostringstream description; - const double lower_bound = -std::numeric_limits::max(); - - description << lower_bound; - - return 0; - } - " - DEAL_II_HAVE_FP_EXCEPTIONS) + CHECK_CXX_SOURCE_COMPILES("${_snippet}" DEAL_II_HAVE_FP_EXCEPTIONS) ENDIF() # @@ -593,4 +587,5 @@ CHECK_CXX_SOURCE_COMPILES( } " DEAL_II_HAVE_COMPLEX_OPERATOR_OVERLOADS) + RESET_CMAKE_REQUIRED()