]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Do not configure CGAL with bundled boost 13759/head
authorMatthias Maier <tamiko@43-1.org>
Thu, 19 May 2022 19:30:02 +0000 (14:30 -0500)
committerMatthias Maier <tamiko@43-1.org>
Thu, 19 May 2022 19:34:07 +0000 (14:34 -0500)
cmake/configure/configure_cgal.cmake
cmake/modules/FindCGAL.cmake

index bd7d53d71d2db29182c7c266886ee7898f7a4ce1..882170ed047fbb91c854a9bc3c1d37c696ffae8e 100644 (file)
 # 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)
index fb4e7cde03bc81bbb7a1cc1a277f994afa8cb728..20ae44e93c1d5123980bb245f4ee75d92fb9620b 100644 (file)
@@ -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)

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.