]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Check for 'std::is_trivially_copyable' correctly. 1065/head
authorDavid Wells <drwells@vt.edu>
Wed, 1 Jul 2015 00:15:34 +0000 (20:15 -0400)
committerDavid Wells <drwells@vt.edu>
Wed, 1 Jul 2015 00:46:51 +0000 (20:46 -0400)
This should be checked whenever C++11 is enabled; more specifically, it
should be checked when compiling with C++14 too.

cmake/checks/check_01_cxx_features.cmake

index 7f00f15a4710957232579bc194654b6de5fd3167..c6997f9c5e196457514c877cce7ca03f880a2031 100644 (file)
@@ -300,6 +300,20 @@ IF(DEFINED DEAL_II_CXX11_FLAG OR DEFINED DEAL_II_CXX14_FLAG
       SET(DEAL_II_HAVE_CXX11 TRUE)
   ENDIF()
 
+  IF(DEAL_II_HAVE_CXX11)
+    #
+    # Some compilers (such as Intel 15.3 and GCC 4.9.2) support the flags
+    # "-std=c++11" and "-std=c++14" but do not support
+    # 'std::is_trivially_copyable', so check for support in C++11 or newer.
+    #
+    CHECK_CXX_SOURCE_COMPILES(
+      "
+    #include <type_traits>
+    int main(){ std::is_trivially_copyable<int> bob; }
+    "
+      DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE)
+  ENDIF()
+
   #
   # This test does not guarantee full C++14 support, but virtually every
   # compiler with some C++14 support implements this.
@@ -389,15 +403,6 @@ IF (DEAL_II_WITH_CXX14)
 ELSEIF(DEAL_II_WITH_CXX11)
   ADD_FLAGS(DEAL_II_CXX_FLAGS "${DEAL_II_CXX_VERSION_FLAG}")
   MESSAGE(STATUS "DEAL_II_WITH_CXX11 successfully set up")
-
-  PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}")
-  CHECK_CXX_SOURCE_COMPILES(
-    "
-    #include <type_traits>
-    int main(){ std::is_trivially_copyable<int> bob; }
-    "
-    DEAL_II_HAVE_CXX11_IS_TRIVIALLY_COPYABLE)
-  RESET_CMAKE_REQUIRED()
 ELSE()
   MESSAGE(STATUS "DEAL_II_WITH_CXX14 and DEAL_II_WITH_CXX11 are both disabled")
 ENDIF()

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.