From 432b03348b73dd7ef534a85bfc6f6c2f9b3c15f4 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Tue, 30 Nov 2021 21:18:11 -0600 Subject: [PATCH] CMake: add a configure check for spurious boost deprecation warnings --- cmake/configure/configure_2_boost.cmake | 20 ++++++++++++++++++++ include/deal.II/base/config.h.in | 3 +++ 2 files changed, 23 insertions(+) diff --git a/cmake/configure/configure_2_boost.cmake b/cmake/configure/configure_2_boost.cmake index cc9dcb4c7e..b61c7a64d5 100644 --- a/cmake/configure/configure_2_boost.cmake +++ b/cmake/configure/configure_2_boost.cmake @@ -74,6 +74,26 @@ MACRO(FEATURE_BOOST_CONFIGURE_COMMON) ENDIF() ENABLE_IF_SUPPORTED(BOOST_CXX_FLAGS "-Wno-unused-local-typedefs") + + # At least BOOST 1.74 has the problem that some of the BOOST headers + # include other BOOST headers that are deprecated, and this then leads to + # warnings. That's rather annoying. + + # The configure function is called only once. In case an externally provided + # boost library is detected, BOOST_INCLUDE_DIRS contains the include paths to + # be used and BOOST_BUNDLED_INCLUDE_DIRS is empty. For the bundled library, it + # is the other way around. + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${BOOST_INCLUDE_DIRS} ${BOOST_BUNDLED_INCLUDE_DIRS}) + + CHECK_CXX_COMPILER_BUG( + " + #define BOOST_CONFIG_HEADER_DEPRECATED_HPP_INCLUDED + #define BOOST_HEADER_DEPRECATED(a) _Pragma(\"GCC error \\\"stop compilation\\\"\"); + #include + int main() { return 0; } + " + DEAL_II_BOOST_HAS_BROKEN_HEADER_DEPRECATIONS) + RESET_CMAKE_REQUIRED() ENDMACRO() diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index a5d1b71519..4c549dff74 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -224,6 +224,9 @@ /* cmake/modules/FindSYMENGINE.cmake */ #cmakedefine DEAL_II_SYMENGINE_WITH_LLVM +/* cmake/configure/configure_2_boost.cmake */ +#cmakedefine DEAL_II_BOOST_HAS_BROKEN_HEADER_DEPRECATIONS + /* cmake/configure/configure_2_trilinos.cmake */ #cmakedefine DEAL_II_TRILINOS_CXX_SUPPORTS_SACADO_COMPLEX_RAD #cmakedefine DEAL_II_TRILINOS_WITH_EPETRAEXT -- 2.39.5