Skip to content

Commit

Permalink
Merge pull request #13759 from tamiko/fix_cgal_configure
Browse files Browse the repository at this point in the history
CMake: Do not configure CGAL with bundled boost
  • Loading branch information
luca-heltai committed May 20, 2022
2 parents 4cb663c + bb8ff57 commit ed3f42a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
37 changes: 37 additions & 0 deletions cmake/configure/configure_cgal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
9 changes: 7 additions & 2 deletions cmake/modules/FindCGAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Try to find the CGAL libraries
#
# This module exports
#
#
# CGAL_INCLUDE_DIRS
#

Expand All @@ -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)
Expand Down

0 comments on commit ed3f42a

Please sign in to comment.