From: Matthias Maier Date: Thu, 19 May 2022 19:30:02 +0000 (-0500) Subject: CMake: Do not configure CGAL with bundled boost X-Git-Tag: v9.4.0-rc1~190^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F13759%2Fhead;p=dealii.git CMake: Do not configure CGAL with bundled boost --- 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)