From 70960dc646b6cfa396584ab4997aeef76424154d Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 24 Mar 2017 23:13:48 +0000 Subject: Workaround for CGAL version 4.8 compilation issue New target CGAL_WITH_EIGEN3_VERSION set with CGAL_VERSION when CGAL and Eigen3 found to ease CMakeLists.txt git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cgal_4.8_issue@2241 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 2fbf1f9397aa1549ba05aa26ac6852b882dce147 --- src/cmake/modules/GUDHI_third_party_libraries.txt | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/cmake/modules') diff --git a/src/cmake/modules/GUDHI_third_party_libraries.txt b/src/cmake/modules/GUDHI_third_party_libraries.txt index 1a2b510f..75f73537 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.txt +++ b/src/cmake/modules/GUDHI_third_party_libraries.txt @@ -24,6 +24,7 @@ endif() # or even better https://cmake.org/cmake/help/v3.1/variable/CMAKE_CXX_STANDARD.html # but it implies to use cmake version 3.1 at least. find_package(CGAL) + # Only CGAL versions > 4.4 supports what Gudhi uses from CGAL if (CGAL_VERSION VERSION_LESS 4.4.0) message("CGAL version ${CGAL_VERSION} is considered too old to be used by Gudhi.") @@ -34,6 +35,25 @@ if(CGAL_FOUND) include( ${CGAL_USE_FILE} ) if (NOT CGAL_VERSION VERSION_LESS 4.8.0) + # HACK to detect CGAL version 4.8.0 + # CGAL version 4.8, 4.8.1 and 4.8.2 are identified as version 4.8.1000) + # cf. https://github.com/CGAL/cgal/issues/1559 + # Limit the HACK between CGAL versions 4.8 and 4.9 because of file read + if (NOT CGAL_VERSION VERSION_GREATER 4.9.0) + foreach(CGAL_INCLUDE_DIR ${CGAL_INCLUDE_DIRS}) + if (EXISTS "${CGAL_INCLUDE_DIR}/CGAL/version.h") + FILE(READ "${CGAL_INCLUDE_DIR}/CGAL/version.h" contents) + STRING(REGEX REPLACE "\n" ";" contents "${contents}") + foreach(Line ${contents}) + if("${Line}" STREQUAL "#define CGAL_VERSION 4.8") + set(CGAL_VERSION 4.8.0) + message (">>>>> HACK CGAL version to ${CGAL_VERSION}") + endif("${Line}" STREQUAL "#define CGAL_VERSION 4.8") + endforeach(Line ${contents}) + endif (EXISTS "${CGAL_INCLUDE_DIR}/CGAL/version.h") + endforeach(CGAL_INCLUDE_DIR ${CGAL_INCLUDE_DIRS}) + endif(NOT CGAL_VERSION VERSION_GREATER 4.9.0) + # For dev version include_directories(BEFORE "src/common/include/gudhi_patches") # For user version @@ -50,11 +70,12 @@ if (TBB_FOUND) add_definitions(-DGUDHI_USE_TBB) endif() +set(CGAL_WITH_EIGEN3_VERSION 0.0.0) find_package(Eigen3 3.1.0) if (EIGEN3_FOUND) message(STATUS "Eigen3 version: ${EIGEN3_VERSION}.") include( ${EIGEN3_USE_FILE} ) - #include_directories (BEFORE "../../include") + set(CGAL_WITH_EIGEN3_VERSION ${CGAL_VERSION}) endif (EIGEN3_FOUND) # Required programs for unitary tests purpose -- cgit v1.2.3