summaryrefslogtreecommitdiff
path: root/src/cmake
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-03-24 23:13:48 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-03-24 23:13:48 +0000
commit70960dc646b6cfa396584ab4997aeef76424154d (patch)
tree828de8d1680dd1e287ce63c7403993940f915510 /src/cmake
parent2aa2c9ac820e7ed50c587855a368ac29f3caed5e (diff)
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
Diffstat (limited to 'src/cmake')
-rw-r--r--src/cmake/modules/GUDHI_third_party_libraries.txt23
1 files changed, 22 insertions, 1 deletions
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