set CGAL_DATA_DIR in CGALconfig.cmake

This commit is contained in:
Sébastien Loriot 2021-02-11 19:18:57 +01:00
parent 4c932630c6
commit 3cefeeb23c
3 changed files with 24 additions and 5 deletions

View File

@ -50,13 +50,12 @@ if (NOT CGAL_DATA_DIR)
set(CGAL_DATA_DIR "${CMAKE_SOURCE_DIR}/Data/data")
else()
message("CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}")
message(FATAL_ERROR "CGAL_DATA_DIR cannot be deduced, please set the variable CGAL_DATA_DIR")
message(WARNING "CGAL_DATA_DIR cannot be deduced, set the variable CGAL_DATA_DIR to set the default value of CGAL::data_file_path()")
endif()
endif()
endif()
endif()
set(CGAL_DATA_DIR "${CMAKE_SOURCE_DIR}/Data/data" CACHE STRING "Directory containing the Data files")
if ( NOT "${CGAL_DATA_DIR}" STREQUAL "" )
add_definitions(-DCGAL_DATA_DIR="${CGAL_DATA_DIR}")
endif()

View File

@ -330,14 +330,12 @@ function(cgal_add_test exe_name)
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../../Data/data")
set(CGAL_DATA_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../Data/data")
else()
message(FATAL_ERROR "CGAL_DATA_DIR cannot be deduced, please set the variable CGAL_DATA_DIR")
message(WARNING "CGAL_DATA_DIR cannot be deduced, set the variable CGAL_DATA_DIR to set the default value of CGAL::data_file_path()")
endif()
endif()
endif()
endif()
message(STATUS "Using CGAL_DATA_DIR = ${CGAL_DATA_DIR}")
file(STRINGS "${cmd_file}" CMD_LINES)
string(CONFIGURE "${CMD_LINES}" CMD_LINES)
set(ARGS)

View File

@ -167,4 +167,26 @@ if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST )
set(CMAKE_NO_SYSTEM_FROM_IMPORTED TRUE)
endif()
#set CGAL_DATA_DIR
if (NOT CGAL_DATA_DIR)
if(DEFINED ENV{CGAL_DATA_DIR})
set(CGAL_DATA_DIR $ENV{CGAL_DATA_DIR})
else()
if (EXISTS "${CGAL_ROOT}/data")
set(CGAL_DATA_DIR "${CGAL_ROOT}/data")
else()
if (EXISTS "${CGAL_ROOT}/Data/data")
set(CGAL_DATA_DIR "${CGAL_ROOT}/Data/data")
else()
message("CMAKE_SOURCE_DIR = ${CGAL_ROOT}")
message(WARNING "CGAL_DATA_DIR cannot be deduced, set the variable CGAL_DATA_DIR to set the default value of CGAL::data_file_path()")
endif()
endif()
endif()
endif()
if ( NOT "${CGAL_DATA_DIR}" STREQUAL "" )
add_definitions(-DCGAL_DATA_DIR="${CGAL_DATA_DIR}")
endif()
include("${CGAL_MODULES_DIR}/CGAL_enable_end_of_configuration_hook.cmake")