forked from Kitware/ParaView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paraview-config.cmake.in
363 lines (319 loc) · 15.5 KB
/
paraview-config.cmake.in
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
#[==[.md
# paraview-config.cmake
This file is used by CMake when finding ParaView.
The following variables are provided by this module:
* `ParaView_VERSION`: The full version of ParaView found.
* `ParaView_VERSION_SIMPLE`: The simple version of ParaView found (eg: 5.9.1).
* `ParaView_VERSION_MAJOR`: The major version of ParaView found.
* `ParaView_VERSION_MINOR`: The minor version of ParaView found.
* `ParaView_VERSION_PATCH`: The patch version of ParaView found.
* `ParaView_PREFIX_PATH`: Install prefix for ParaView.
* `PARAVIEW_USE_QT`: If ParaView's Qt GUI is available.
* `PARAVIEW_QT_MAJOR_VERSION`: Major version of Qt used by ParaView if PARAVIEW_USE_QT is TRUE
* `PARAVIEW_USE_MPI`: If ParaView is built with MPI support.
* `PARAVIEW_USE_PYTHON`: If ParaView is built with Python support.
* `PARAVIEW_USE_SERIALIZATION`: If ParaView is built with Serialization support.
* `PARAVIEW_USE_QTWEBENGINE`: If ParaView uses Qt's WebEngine for its help.
* `PARAVIEW_PYTHONPATH`: Where ParaView's Python modules live under the
install prefix. Unset if Python is not available.
* `PARAVIEW_PLUGIN_SUBDIR`: The subdirectory under the library directory for
plugins.
* `ParaView_CLIENT_XML_FILES`: XML files for client applications to use to
reproduce ParaView's menu items. Only provided if `PARAVIEW_USE_QT`
is set.
* `ParaView_LIBRARIES`: The list of modules specified by `COMPONENTS` and
`OPTIONAL_COMPONENTS`. This may be used in `MODULES` arguments in the API
(e.g., `vtk_module_autoinit`). All modules are also targets and may be
linked to using `target_link_libraries`.
* `ParaView_CATALYST_DIR`: The directory to the ParaView Catalyst
implementation (if present).
#]==]
if (CMAKE_VERSION VERSION_LESS "3.12")
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
set("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE"
"ParaView requires CMake 3.12 in order to reliably be used.")
return ()
endif ()
cmake_policy(PUSH)
cmake_policy(VERSION 3.12)
set(${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save "${CMAKE_MODULE_PATH}")
list(INSERT CMAKE_MODULE_PATH 0
"${CMAKE_CURRENT_LIST_DIR}")
set("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save" "${CMAKE_PREFIX_PATH}")
include("${CMAKE_CURRENT_LIST_DIR}/paraview-prefix.cmake")
set("${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH"
"${_vtk_module_import_prefix}")
unset(_vtk_module_import_prefix)
list(INSERT CMAKE_PREFIX_PATH 0
"${${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH}")
set("${CMAKE_FIND_PACKAGE_NAME}_VERSION" "@PARAVIEW_VERSION_FULL@")
set("${CMAKE_FIND_PACKAGE_NAME}_VERSION_SIMPLE" "@PARAVIEW_VERSION@")
set("${CMAKE_FIND_PACKAGE_NAME}_VERSION_MAJOR" "@PARAVIEW_VERSION_MAJOR@")
set("${CMAKE_FIND_PACKAGE_NAME}_VERSION_MINOR" "@PARAVIEW_VERSION_MINOR@")
set("${CMAKE_FIND_PACKAGE_NAME}_VERSION_PATCH" "@PARAVIEW_VERSION_PATCH@")
unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND")
set(_paraview_use_external_vtk "@PARAVIEW_USE_EXTERNAL_VTK@")
set(_paraview_find_package_args)
if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND _paraview_find_package_args
QUIET)
endif ()
if (NOT _paraview_use_external_vtk)
list(APPEND _paraview_find_package_args
PATHS "${CMAKE_CURRENT_LIST_DIR}/vtk"
NO_DEFAULT_PATH)
# Find VTK with just `CommonCore` to get the available targets first. Only
# required for a vendored VTK since external targets are not checked by CMake
# later.
find_package(VTK REQUIRED
${_paraview_find_package_args}
COMPONENTS CommonCore)
endif ()
unset(_paraview_use_external_vtk)
set(PARAVIEW_USE_QT "@PARAVIEW_USE_QT@")
set(PARAVIEW_QT_MAJOR_VERSION "@PARAVIEW_QT_MAJOR_VERSION@")
set(PARAVIEW_USE_MPI "@PARAVIEW_USE_MPI@")
set(PARAVIEW_USE_PYTHON "@PARAVIEW_USE_PYTHON@")
set(PARAVIEW_USE_SERIALIZATION "@PARAVIEW_USE_SERIALIZATION@")
set(PARAVIEW_USE_QTWEBENGINE "@PARAVIEW_USE_QTWEBENGINE@")
set(PARAVIEW_PLUGIN_SUBDIR "paraview@paraview_version_suffix@/plugins")
if (PARAVIEW_USE_PYTHON)
set(PARAVIEW_PYTHONPATH "@PARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX@")
include("${CMAKE_CURRENT_LIST_DIR}/ParaViewPython-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ParaViewPythonIncubator-targets.cmake")
# Unset this for now; these targets will be defined later.
unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND")
unset("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE")
endif ()
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-properties.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/paraview-find-package-helpers.cmake" OPTIONAL)
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-find-packages.cmake")
if ("INCUBATOR" IN_LIST "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
list(REMOVE_ITEM "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS"
INCUBATOR)
# This component is always found.
set("${CMAKE_FIND_PACKAGE_NAME}_INCUBATOR_FOUND" 1)
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Incubator-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Incubator-vtk-module-properties.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Incubator-vtk-module-find-packages.cmake")
else ()
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Incubator-targets.cmake")
set("${CMAKE_FIND_PACKAGE_NAME}_INCUBATOR_FOUND" 0)
set("${CMAKE_FIND_PACKAGE_NAME}_INCUBATOR_NOT_FOUND_MESSAGE" "the `INCUBATOR` component was not requested")
endif ()
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-paraview_plugins-targets-depends.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-paraview-plugin-properties.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Clients-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Clients-vtk-module-properties.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ParaViewTools-targets.cmake" OPTIONAL)
# Gather the list of required VTK components.
set(_paraview_vtk_components_to_request_required)
set(_paraview_vtk_components_to_request_optional)
if (${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
set(_paraview_search_components
"${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS}")
else ()
set(_paraview_search_components
"@_paraview_all_components@")
endif ()
foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
# Ignore non-existent components here.
if (NOT TARGET "ParaView::${_paraview_component}")
continue ()
endif ()
# Get all module dependencies.
get_property(_paraview_component_depends
TARGET "ParaView::${_paraview_component}"
PROPERTY "INTERFACE_vtk_module_depends")
get_property(_paraview_component_private_depends
TARGET "ParaView::${_paraview_component}"
PROPERTY "INTERFACE_vtk_module_private_depends")
get_property(_paraview_component_optional_depends
TARGET "ParaView::${_paraview_component}"
PROPERTY "INTERFACE_vtk_module_optional_depends")
# Keep only VTK dependencies.
set(_paraview_component_vtk_depends
${_paraview_component_depends}
${_paraview_component_private_depends})
set(_paraview_component_vtk_optional_depends
${_paraview_component_optional_depends})
list(FILTER _paraview_component_vtk_depends INCLUDE REGEX "^VTK::")
list(FILTER _paraview_component_vtk_optional_depends INCLUDE REGEX "^VTK::")
string(REPLACE "VTK::" "" _paraview_component_vtk_depends "${_paraview_component_vtk_depends}")
string(REPLACE "VTK::" "" _paraview_component_vtk_optional_depends "${_paraview_component_vtk_optional_depends}")
if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_paraview_component})
list(APPEND _paraview_vtk_components_to_request_required
${_paraview_component_vtk_depends})
else ()
list(APPEND _paraview_vtk_components_to_request_optional
${_paraview_component_vtk_depends})
endif ()
list(APPEND _paraview_vtk_components_to_request_optional
${_paraview_component_vtk_optional_depends})
endforeach ()
unset(_paraview_component)
unset(_paraview_component_depends)
unset(_paraview_component_private_depends)
unset(_paraview_component_optional_depends)
unset(_paraview_component_vtk_optional_depends)
unset(_paraview_component_vtk_depends)
# Remove duplicate component requests.
if (_paraview_vtk_components_to_request_required)
list(REMOVE_DUPLICATES _paraview_vtk_components_to_request_required)
endif ()
if (_paraview_vtk_components_to_request_optional)
list(REMOVE_DUPLICATES _paraview_vtk_components_to_request_optional)
endif ()
# Modules which are required should be removed from the optional component
# list.
if (_paraview_vtk_components_to_request_required)
list(REMOVE_ITEM _paraview_vtk_components_to_request_optional
${_paraview_vtk_components_to_request_required})
endif()
# Now find VTK with all of the components we require.
find_package(VTK REQUIRED
${_paraview_find_package_args}
COMPONENTS ${_paraview_vtk_components_to_request_required}
OPTIONAL_COMPONENTS ${_paraview_vtk_components_to_request_optional})
if (NOT VTK_FOUND)
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
endif ()
unset(_paraview_find_package_args)
unset(_paraview_vtk_components_to_request_required)
unset(_paraview_vtk_components_to_request_optional)
include("${CMAKE_CURRENT_LIST_DIR}/ParaViewClient.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ParaViewPlugin.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ParaViewServerManager.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ParaViewTesting.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/vtkModuleWrapClientServer.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ParaViewTranslations.cmake")
if (@paraview_has_catalyst@) # paraview_has_catalyst
set("${CMAKE_FIND_PACKAGE_NAME}_CATALYST_DIR"
"${${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH}/@paraview_catalyst_directory@")
endif ()
if (@PARAVIEW_USE_PYTHON@) # PARAVIEW_USE_PYTHON
include("${CMAKE_CURRENT_LIST_DIR}/paraview.modules-vtk-python-module-properties.cmake")
if(${CMAKE_FIND_PACKAGE_NAME}_INCUBATOR_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/paraview.incubator-vtk-python-module-properties.cmake")
endif ()
endif ()
if (@PARAVIEW_USE_QT@) # PARAVIEW_USE_QT
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Client-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/ParaView-client-xml.cmake")
endif ()
set(_paraview_components_to_check)
foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND")
# It was already not-found (likely due to `find-package` failures).
elseif (TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}")
list(APPEND _paraview_components_to_check
"${_paraview_component}")
else ()
set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0)
list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE"
"The ${_paraview_component} component is not available.")
endif ()
endforeach ()
unset(_paraview_component)
set(_paraview_vtk_components)
while (_paraview_components_to_check)
list(GET _paraview_components_to_check 0 _paraview_component)
list(REMOVE_AT _paraview_components_to_check 0)
if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND")
# We've already made a determiniation.
continue ()
endif ()
get_property(_paraview_dependencies
TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}"
PROPERTY "INTERFACE_paraview_module_depends")
string(REPLACE "${CMAKE_FIND_PACKAGE_NAME}::" "" _paraview_dependencies "${_paraview_dependencies}")
set(_paraview_all_dependencies_checked TRUE)
foreach (_paraview_dependency IN LISTS _paraview_dependencies)
# Handle VTK module dependencies.
string(FIND "${_paraview_component}" "VTK::" _paraview_vtk_idx)
if (NOT _paraview_vtk_idx EQUAL -1)
unset(_paraview_vtk_idx)
if (NOT TARGET "${_paraview_dependency}")
set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0)
list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE"
"Failed to find the ${_paraview_dependency} module.")
endif ()
continue ()
endif ()
unset(_paraview_vtk_idx)
if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_dependency}_FOUND")
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_paraview_dependency}_FOUND)
set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0)
list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE"
"Failed to find the ${_paraview_dependency} component.")
endif ()
else ()
# Check its dependencies.
list(APPEND _paraview_components_to_check
"${_paraview_dependency}")
set(_paraview_all_found FALSE)
endif ()
endforeach ()
if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND")
if (_paraview_all_dependencies_checked)
set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 1)
else ()
list(APPEND _paraview_components_to_check
"${_paraview_component}")
endif ()
endif ()
unset(_paraview_all_dependencies_checked)
unset(_paraview_dependency)
unset(_paraview_dependencies)
endwhile ()
unset(_paraview_component)
unset(_paraview_components_to_check)
set(_paraview_missing_components)
foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND AND ${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_paraview_component})
list(APPEND _paraview_missing_components
"${_paraview_component}")
endif ()
endforeach ()
if (_paraview_missing_components)
list(REMOVE_DUPLICATES _paraview_missing_components)
list(SORT _paraview_missing_components)
string(REPLACE ";" ", " _paraview_missing_components "${_paraview_missing_components}")
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
set("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE"
"Could not find the ${CMAKE_FIND_PACKAGE_NAME} package with the following required components: ${_paraview_missing_components}.")
endif ()
unset(_paraview_missing_components)
set("${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES")
if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_FOUND")
# If nothing went wrong, we've successfully found the package.
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 1)
# Build the `_LIBRARIES` variable.
foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES"
"${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}")
endforeach ()
unset(_paraview_component)
endif ()
set(CMAKE_PREFIX_PATH "${${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save}")
unset("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save")
set(CMAKE_MODULE_PATH "${${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save}")
unset(${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save)
# Compatibility with old code.
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION)
set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-deprecated.cmake")
elseif (${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS 5.7)
set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-compat.cmake")
else ()
set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-error.cmake")
endif ()
# 5.8 renamed these variables, so provide them if 5.8 is not the minimum
# requested.
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION OR
${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS "5.8")
set(PARAVIEW_BUILD_QT_GUI "${PARAVIEW_USE_QT}")
set(PARAVIEW_ENABLE_PYTHON "${PARAVIEW_USE_PYTHON}")
endif ()
cmake_policy(POP)