From: Matthias Maier Date: Thu, 27 Aug 2015 22:48:15 +0000 (-0500) Subject: Bugfix: Test for header instead of X-Git-Tag: v8.4.0-rc2~529^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1449%2Fhead;p=dealii.git Bugfix: Test for header instead of We include the C++11 version in the testuite. Silently, fix another test as well. This fixes the testsuite for use in C++98/03 mode. --- diff --git a/cmake/checks/check_01_cxx_features.cmake b/cmake/checks/check_01_cxx_features.cmake index e154e345f2..a21768720e 100644 --- a/cmake/checks/check_01_cxx_features.cmake +++ b/cmake/checks/check_01_cxx_features.cmake @@ -424,13 +424,17 @@ ENDIF() # "-std=c++11" and "-std=c++14" but do not support # 'std::is_trivially_copyable', so check for support in C++11 or newer. # -IF(DEAL_II_HAVE_CXX11) +IF(DEAL_II_WITH_CXX11) + PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") CHECK_CXX_SOURCE_COMPILES( " #include int main(){ std::is_trivially_copyable bob; } " DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE) + RESET_CMAKE_REQUIRED() +ELSE() + SET(DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE FALSE) ENDIF() CHECK_CXX_SOURCE_COMPILES( @@ -466,7 +470,7 @@ CHECK_CXX_SOURCE_COMPILES( # -# Check that we can use feenableexcept. Sets DEAL_II_HAVE_FP_EXCEPTIONS +# Check that we can use feenableexcept through the C++11 header file cfenv: # # The test is a bit more complicated because we also check that no garbage # exception is thrown if we convert -std::numeric_limits::max to a @@ -475,46 +479,53 @@ CHECK_CXX_SOURCE_COMPILES( # - Timo Heister, 2015 # -IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) - CHECK_CXX_SOURCE_RUNS( - " - #include - #include - #include +# This test requires C++11 +IF(DEAL_II_WITH_CXX11) + PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}") + IF(DEAL_II_ALLOW_PLATFORM_INTROSPECTION) + CHECK_CXX_SOURCE_RUNS( + " + #include + #include + #include - int main() - { - feenableexcept(FE_DIVBYZERO|FE_INVALID); - std::ostringstream description; - const double lower_bound = -std::numeric_limits::max(); + int main() + { + feenableexcept(FE_DIVBYZERO|FE_INVALID); + std::ostringstream description; + const double lower_bound = -std::numeric_limits::max(); - description << lower_bound; + description << lower_bound; - return 0; - } - " - 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 + return 0; + } + " + 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(); + int main() + { + feenableexcept(FE_DIVBYZERO|FE_INVALID); + std::ostringstream description; + const double lower_bound = -std::numeric_limits::max(); - description << lower_bound; + description << lower_bound; - return 0; - } - " - DEAL_II_HAVE_FP_EXCEPTIONS) + return 0; + } + " + DEAL_II_HAVE_FP_EXCEPTIONS) + ENDIF() + RESET_CMAKE_REQUIRED() +ELSE() + SET(DEAL_II_HAVE_FP_EXCEPTIONS FALSE) ENDIF()