Fix the construction of CGAL_ROOT in header-only

In header-only, `CGALConfig.cmake` constructs the path to the root of
the CGAL installation. It used to use `../` a lot, to go back in
parent directories, but:
  - that was... ugly,
  - and Ninja saw a problem with that (a warning about the path to
  `print_GMP_version.cpp`).

`CGALConfig.cmake` Now uses the CMake command `get_filename_component`.
This commit is contained in:
Laurent Rineau 2018-11-28 09:46:53 +01:00
parent b02d174ef2
commit 81cf49efb1
1 changed files with 9 additions and 2 deletions

View File

@ -26,7 +26,11 @@ endfunction()
cgal_detect_branch_build(BRANCH_BUILD)
if(BRANCH_BUILD)
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)
get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY)
get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY)
set(CGAL_INSTALLATION_PACKAGE_DIR ${CGAL_ROOT}/Installation)
set(CGAL_GRAPHICSVIEW_PACKAGE_DIR ${CGAL_ROOT}/GraphicsView)
set(CGAL_MODULES_DIR ${CGAL_ROOT}/Installation/cmake/modules)
@ -43,7 +47,10 @@ if(BRANCH_BUILD)
endif()
endforeach()
else()
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)
get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY)
# not BRANCH_BUILD: it can be an installed CGAL, or the tarball layout
if(EXISTS ${CGAL_CONFIG_DIR}/CGAL_add_test.cmake)