From e627892a511d94af4be30cedaa8a119cef6ea256 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Fri, 30 Mar 2018 12:23:57 +0200 Subject: [PATCH] Detect std::auto_ptr support --- cmake/configure/configure_boost.cmake | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cmake/configure/configure_boost.cmake b/cmake/configure/configure_boost.cmake index cdbdaecd1b..9ee75e6376 100644 --- a/cmake/configure/configure_boost.cmake +++ b/cmake/configure/configure_boost.cmake @@ -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 + + int main() + { + int *i = new int; + std::auto_ptr 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() -- 2.39.5