From: Daniel Arndt Date: Fri, 30 Mar 2018 10:23:57 +0000 (+0200) Subject: Detect std::auto_ptr support X-Git-Tag: v9.0.0-rc1~262^2~1 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e627892a511d94af4be30cedaa8a119cef6ea256;p=dealii.git Detect std::auto_ptr support --- 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()