Fix the detection of CGAL_ROOT

On Debian, CMake files are in
`/usr/local/lib/x86_64-linux-gnu/cmake/CGAL/` are our previous heuristic fails.
This commit is contained in:
Laurent Rineau 2019-10-11 11:00:29 +02:00
parent 5be38d3af0
commit 08a42cf35b
3 changed files with 13 additions and 7 deletions

View File

@ -928,7 +928,10 @@ if(NOT CGAL_HEADER_ONLY)
${CMAKE_BINARY_DIR}/config/CGALConfig.cmake ${CMAKE_BINARY_DIR}/config/CGALConfig.cmake
DESTINATION ${CGAL_INSTALL_CMAKE_DIR} ) DESTINATION ${CGAL_INSTALL_CMAKE_DIR} )
else() else()
configure_file(${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfig-installation-dirs.cmake.in
${CMAKE_BINARY_DIR}/config/CGALConfig-installation-dirs.cmake)
install(FILES install(FILES
${CMAKE_BINARY_DIR}/config/CGALConfig-installation-dirs.cmake
${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfig.cmake ${CMAKE_CURRENT_LIST_DIR}/lib/cmake/CGAL/CGALConfig.cmake
DESTINATION ${CGAL_INSTALL_CMAKE_DIR} ) DESTINATION ${CGAL_INSTALL_CMAKE_DIR} )
endif() endif()

View File

@ -0,0 +1 @@
set(CGAL_ROOT @CMAKE_INSTALL_PREFIX@)

View File

@ -43,6 +43,8 @@ if(BRANCH_BUILD)
endif() endif()
endforeach() endforeach()
else() else()
include(${CGAL_CONFIG_DIR}/CGALConfig-installation-dirs.cmake OPTIONAL RESULT_VARIABLE _has_installation_dirs)
if(NOT _has_installation_dirs)
set(CGAL_ROOT ${CGAL_CONFIG_DIR}) set(CGAL_ROOT ${CGAL_CONFIG_DIR})
get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY)
if(NOT EXISTS ${CGAL_ROOT}/include/CGAL/config.h) if(NOT EXISTS ${CGAL_ROOT}/include/CGAL/config.h)
@ -51,7 +53,7 @@ else()
if(NOT EXISTS ${CGAL_ROOT}/include/CGAL/config.h) if(NOT EXISTS ${CGAL_ROOT}/include/CGAL/config.h)
get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY)
endif() endif()
endif()
# not BRANCH_BUILD: it can be an installed CGAL, or the tarball layout # not BRANCH_BUILD: it can be an installed CGAL, or the tarball layout
if(EXISTS ${CGAL_CONFIG_DIR}/CGAL_add_test.cmake) if(EXISTS ${CGAL_CONFIG_DIR}/CGAL_add_test.cmake)
# installed CGAL # installed CGAL