]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Detect std::auto_ptr support
authorDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 30 Mar 2018 10:23:57 +0000 (12:23 +0200)
committerDaniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Fri, 30 Mar 2018 10:55:45 +0000 (12:55 +0200)
cmake/configure/configure_boost.cmake

index cdbdaecd1b516fb4e1b9f9b211bebddfd4b1acad..9ee75e637685f0f6a3fcae2f9189c9c03cf05c61 100644 (file)
@@ -53,6 +53,33 @@ MACRO(FEATURE_BOOST_CONFIGURE_COMMON)
     LIST(APPEND BOOST_USER_DEFINITIONS "BOOST_NO_CXX11_HDR_UNORDERED_MAP")
   ENDIF()
 
+  # Some standard library implementations do not implement std::auto_ptr
+  # (anymore) which was deprecated for C++11 and removed in the C++17 standard.
+  # Older boost versions can't know about this but provide a possibility to
+  # circumvent the issue. Hence, we just check ourselves.
+  PUSH_CMAKE_REQUIRED("${DEAL_II_CXX_VERSION_FLAG}")
+  PUSH_CMAKE_REQUIRED("-Werror")
+
+  CHECK_CXX_SOURCE_COMPILES(
+    "
+    #include <memory>
+
+    int main()
+    {
+      int *i = new int;
+      std::auto_ptr<int> x(i);
+      return 0;
+    }
+    "
+    DEAL_II_HAS_AUTO_PTR)
+
+  RESET_CMAKE_REQUIRED()
+
+  IF( NOT DEAL_II_HAS_AUTO_PTR )
+    LIST(APPEND BOOST_DEFINITIONS "BOOST_NO_AUTO_PTR")
+    LIST(APPEND BOOST_USER_DEFINITIONS "BOOST_NO_AUTO_PTR")
+  ENDIF()
+
   ENABLE_IF_SUPPORTED(BOOST_CXX_FLAGS "-Wno-unused-local-typedefs")
 ENDMACRO()
 

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.