-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCGALConfig.cmake
More file actions
184 lines (159 loc) · 5.57 KB
/
CGALConfig.cmake
File metadata and controls
184 lines (159 loc) · 5.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#
# This file is the CGALConfig.cmake for a header-only CGAL installation
#
# For UseCGAL.cmake
set( CGAL_REQUESTED_COMPONENTS ${CGAL_FIND_COMPONENTS} )
set(CGAL_LIBRARIES CGAL)
get_filename_component(CGAL_CONFIG_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
function(cgal_detect_branch_build VAR_NAME)
if(IS_DIRECTORY ${CGAL_CONFIG_DIR}/../../../../Installation/package_info/Installation/)
set(${VAR_NAME} TRUE PARENT_SCOPE)
else()
set(${VAR_NAME} FALSE PARENT_SCOPE)
endif()
endfunction()
set(CGAL_FOUND FALSE)
cgal_detect_branch_build(BRANCH_BUILD)
if(BRANCH_BUILD)
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)
file(GLOB packages_dirs ${CGAL_ROOT}/*)
# message("packages_dirs: ${packages_dirs}")
foreach(package_dir ${packages_dirs})
set(inc_dir ${package_dir}/include)
if(IS_DIRECTORY ${inc_dir}
AND IS_DIRECTORY ${package_dir}/package_info)
list(APPEND CGAL_INCLUDE_DIRS ${inc_dir})
if(EXISTS ${inc_dir}/CGAL/config.h)
set(CGAL_FOUND TRUE)
endif()
endif()
endforeach()
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})
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()
if(NOT EXISTS ${CGAL_ROOT}/include/CGAL/config.h)
get_filename_component(CGAL_ROOT "${CGAL_ROOT}" DIRECTORY)
endif()
endif()
# not BRANCH_BUILD: it can be an installed CGAL, or the tarball layout
if(EXISTS ${CGAL_CONFIG_DIR}/CGAL_add_test.cmake)
# installed CGAL
set(CGAL_MODULES_DIR ${CGAL_CONFIG_DIR})
else()
# tarball
set(CGAL_MODULES_DIR ${CGAL_ROOT}/cmake/modules)
endif()
set(CGAL_INSTALLATION_PACKAGE_DIR ${CGAL_ROOT})
set(CGAL_GRAPHICSVIEW_PACKAGE_DIR ${CGAL_ROOT})
set(CGAL_INCLUDE_DIRS ${CGAL_ROOT}/include)
if(EXISTS ${CGAL_ROOT}/include/CGAL/config.h)
set(CGAL_FOUND TRUE)
endif()
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("CGAL_ROOT = ${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 TARGET CGAL::Data)
add_library(CGAL::Data INTERFACE IMPORTED)
if ( NOT "${CGAL_DATA_DIR}" STREQUAL "" )
set_target_properties(CGAL::Data PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "CGAL_DATA_DIR=\"${CGAL_DATA_DIR}\"")
endif()
endif()
include(${CGAL_MODULES_DIR}/CGAL_CreateSingleSourceCGALProgram.cmake)
include(${CGAL_MODULES_DIR}/CGAL_Macros.cmake)
include(${CGAL_MODULES_DIR}/CGAL_Common.cmake)
include(${CGAL_MODULES_DIR}/CGAL_TweakFindBoost.cmake)
set(CGAL_USE_FILE ${CGAL_MODULES_DIR}/UseCGAL.cmake)
foreach(comp ${CGAL_FIND_COMPONENTS})
if(NOT comp MATCHES "Core|ImageIO|Qt5")
message(FATAL_ERROR "The requested CGAL component ${comp} does not exist!")
endif()
if(comp MATCHES "Core" AND CGAL_DISABLE_GMP)
message("CGAL_Core needs GMP and won't be used.")
else()
list(APPEND CGAL_LIBRARIES CGAL_${comp})
endif()
endforeach()
set(CGALConfig_all_targets_are_defined TRUE)
foreach(cgal_lib ${CGAL_LIBRARIES})
if(TARGET CGAL::${cgal_lib})
set(${cgal_lib}_FOUND TRUE)
else()
set(CGALConfig_all_targets_are_defined FALSE)
endif()
endforeach()
if(CGALConfig_all_targets_are_defined)
return()
endif()
message(STATUS "Using header-only CGAL")
if(NOT CGAL_FOUND)
return()
endif()
list(APPEND CMAKE_MODULE_PATH ${CGAL_MODULES_DIR})
include( ${CGAL_MODULES_DIR}/CGAL_SCM.cmake )
CGAL_detect_git(${CGAL_CONFIG_DIR}/../../../..)
#
# Search for all dependencies
#
foreach(cgal_lib ${CGAL_LIBRARIES})
include(CGAL_Setup${cgal_lib}Dependencies)
endforeach()
# this include has to be after the loop that includes the
# `CGAL_Setup${cgal_lib}Dependencies` files
include(CGAL_setup_target_dependencies)
#
# Define the CGAL targets and their CGAL:: aliases
#
foreach(cgal_lib ${CGAL_LIBRARIES})
set(WITH_${cgal_lib} TRUE)
if(${cgal_lib}_FOUND AND NOT TARGET ${cgal_lib})
add_library(${cgal_lib} INTERFACE IMPORTED GLOBAL)
if(NOT TARGET CGAL::${cgal_lib})
add_library(CGAL::${cgal_lib} ALIAS ${cgal_lib})
endif()
CGAL_setup_target_dependencies(${cgal_lib})
endif()
endforeach()
include(${CGAL_CONFIG_DIR}/CGALConfigVersion.cmake)
#
#
#
# Temporary? Change the CMAKE module path
cgal_setup_module_path()
set(CGAL_USE_FILE ${CGAL_MODULES_DIR}/UseCGAL.cmake)
include(${CGAL_MODULES_DIR}/CGAL_target_use_TBB.cmake)
if( CGAL_DEV_MODE OR RUNNING_CGAL_AUTO_TEST )
# Do not use -isystem for CGAL include paths
set(CMAKE_NO_SYSTEM_FROM_IMPORTED TRUE)
endif()
include("${CGAL_MODULES_DIR}/CGAL_enable_end_of_configuration_hook.cmake")