From bb8ff5717f4be0b34ba4adbdcf7366ae937c1512 Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Thu, 19 May 2022 14:30:02 -0500 Subject: [PATCH] CMake: Do not configure CGAL with bundled boost --- cmake/configure/configure_cgal.cmake | 37 ++++++++++++++++++++++++++++ cmake/modules/FindCGAL.cmake | 9 +++++-- 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/cmake/configure/configure_cgal.cmake b/cmake/configure/configure_cgal.cmake index bd7d53d71d..882170ed04 100644 --- a/cmake/configure/configure_cgal.cmake +++ b/cmake/configure/configure_cgal.cmake @@ -17,4 +17,41 @@ # Configuration for the CGAL library: # +IF(NOT FEATURE_BOOST_PROCESSED) + MESSAGE(FATAL_ERROR "\n" + "Internal build system error: The configuration of " + "DEAL_II_WITH_CGAL depends on " + "DEAL_II_WITH_BOOST, but CONFIGURE_FEATURE(CGAL) " + "was called before CONFIGURE_FEATURE(BOOST).\n\n" + ) +ENDIF() + + +MACRO(FEATURE_CGAL_FIND_EXTERNAL var) + FIND_PACKAGE(CGAL) + + IF(CGAL_FOUND) + SET(${var} TRUE) + ENDIF() + + # + # CGAL requires an full, externally installed Boost library. We can thus + # not configure our internal boost and try to use CGAL at the same time. + # + IF(FEATURE_BOOST_BUNDLED_CONFIGURED) + MESSAGE(STATUS + "Could not find a sufficient CGAL installation: " + "CGAL links against external Boost but deal.II was configured " + "with bundled Boost." + ) + SET(CGAL_ADDITIONAL_ERROR_STRING + ${CGAL_ADDITIONAL_ERROR_STRING} + "Could not find a sufficient CGAL installation:\n" + "CGAL links against external Boost but deal.II was configured " + "with bundled Boost.\n\n" + ) + SET(${var} FALSE) + ENDIF() +ENDMACRO() + CONFIGURE_FEATURE(CGAL) diff --git a/cmake/modules/FindCGAL.cmake b/cmake/modules/FindCGAL.cmake index fb4e7cde03..20ae44e93c 100644 --- a/cmake/modules/FindCGAL.cmake +++ b/cmake/modules/FindCGAL.cmake @@ -17,7 +17,7 @@ # Try to find the CGAL libraries # # This module exports -# +# # CGAL_INCLUDE_DIRS # @@ -28,7 +28,12 @@ IF(NOT "${CGAL_DIR}" STREQUAL "") SET(CGAL_DIR ${CGAL_DIR}) ENDIF() -IF(DEAL_II_HAVE_CXX17) +# +# CGAL requires C++17 and an externally configured Boost, otherwise the +# call to FIND_PACKAGE(CGAL) will fail. Guard the call to FIND_PACKAGE to +# fail cracefully: +# +IF(DEAL_II_HAVE_CXX17 AND NOT FEATURE_BOOST_BUNDLED_CONFIGURED) # temporarily disable ${CMAKE_SOURCE_DIR}/cmake/modules for module lookup LIST(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules/) SET(CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE ON) -- 2.39.5