From 4782ea16656e0896dda83840397020c7d2b7d7b8 Mon Sep 17 00:00:00 2001 From: Laurent Rineau Date: Tue, 19 Mar 2019 16:49:31 +0100 Subject: [PATCH] Fix the *installed* header-only CGALConfig.cmake The previous installed version of `CGALConfig.cmake`, when `CGAL_HEADER_ONLY` is true, was hard-coding a path `../../../`, relative to the location of itself. It might be that the CMake modules are not installed in a sub-directory with three components, relatively to the prefix. That way of doing it buggy. And that triggered issue with the cgal port in vcpkg: https://github.com/Microsoft/vcpkg/pull/5734 This patch is just another hack: it hardcodes that the relative path can be any of: - `../`, - `../../`, or - `../../../`. --- Installation/lib/cmake/CGAL/CGALConfig.cmake | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Installation/lib/cmake/CGAL/CGALConfig.cmake b/Installation/lib/cmake/CGAL/CGALConfig.cmake index 0cb7f0326bb..f3b6add50ce 100644 --- a/Installation/lib/cmake/CGAL/CGALConfig.cmake +++ b/Installation/lib/cmake/CGAL/CGALConfig.cmake @@ -19,6 +19,7 @@ function(cgal_detect_branch_build VAR_NAME) endif() endfunction() +set(CGAL_FOUND FALSE) cgal_detect_branch_build(BRANCH_BUILD) if(BRANCH_BUILD) set(CGAL_ROOT ${CGAL_CONFIG_DIR}) @@ -44,8 +45,12 @@ if(BRANCH_BUILD) else() set(CGAL_ROOT ${CGAL_CONFIG_DIR}) get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) - 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) + get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) + endif() + if(NOT EXISTS ${CGAL_ROOT}/include/CGAL/config.h) + get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY) + endif() # not BRANCH_BUILD: it can be an installed CGAL, or the tarball layout if(EXISTS ${CGAL_CONFIG_DIR}/CGAL_add_test.cmake)