forked from Kitware/VTK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvtk-config.cmake.in
352 lines (310 loc) · 14.1 KB
/
vtk-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
#[==[.md
# vtk-config.cmake
This file is used by CMake when finding VTK. It provides the [VTK module
API][] as well as some VTK-specific APIs.
The following variables are provided by this module:
* `VTK_VERSION`: The version of VTK found.
* `VTK_MAJOR_VERSION`: The major version of VTK found.
* `VTK_MINOR_VERSION`: The minor version of VTK found.
* `VTK_BUILD_VERSION`: The build version of VTK found.
* `VTK_AVAILABLE_COMPONENTS`: Components available with VTK.
* `VTK_PREFIX_PATH`: Install prefix for VTK.
* `VTK_LEGACY_REMOVE`: Whether VTK's deprecated APIs are
compiled out or not.
* `VTK_HAS_VTKm`: If VTK provides VTK-m.
* `VTK_OPENGL_HAS_EGL`: If VTK::opengl uses EGL. Only provided if the
`VTK::opengl` target exists.
* `VTK_PYTHON_VERSION`: The major version of Python used by VTK. Empty if
Python support is not available.
* `VTK_WRAP_PYTHON`: If VTK itself provides Python wrapping. If so, the
Python parts of the module API are available.
* `VTK_WRAP_JAVA`: If VTK itself provides Java wrapping. If so, the
Java parts of the module API are available.
* `VTK_PYTHONPATH`: Where VTK's Python modules live inside the install
prefix. Unset if Python is not available.
* `VTK_LIBRARIES`: The list of modules specified by `COMPONENTS` and
`OPTIONAL_COMPONENTS`. However, if no components are specified, all
available components are added to this variable. 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`.
* `VTK_AUTOINIT_INCLUDE`: The header to include for access to VTK's autoinit
support.
* `VTK_QT_VERSION`: The major version of Qt used by VTK if Qt support enabled.
* `VTK_QML_DIR`: Where VTK's QML plugins live if QML support is enabled.
* `VTK_ENABLE_OPENVR_COLLABORATION`: Is VR collaboration enabled when OpenVR is enabled.
* `VTK_SMP_BACKENDS`: The list of available SMP backends.
For more information about the Python in use by VTK, the `VTK_PYTHON_VERSION`
variable may be used to query the `find_package(Python)` that VTK performs
internally (note that the `Python` component must be found to guarantee that
this happens). For example, the following information would be useful:
- the `Python${VTK_PYTHON_VERSION}_VERSION` variable; and
- the `Python${VTK_PYTHON_VERSION}::Python` target.
See [FindPython2][] and [FindPython3][] documentation for all of the available
data.
[FindPython2]: https://cmake.org/cmake/help/v3.13/module/FindPython2.html
[FindPython3]: https://cmake.org/cmake/help/v3.13/module/FindPython3.html
[VTK module API]: TODO: Link to hosted documentation.
#]==]
if (CMAKE_VERSION VERSION_LESS "3.12")
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
set("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE"
"VTK requires CMake 3.12 in order to reliably be used.")
return ()
endif ()
cmake_policy(PUSH)
cmake_policy(VERSION 3.12)
set(_vtk_temp_variables)
set(_vtk_real_components)
foreach (_vtk_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
if (_vtk_component MATCHES "^vtk" AND
NOT _vtk_component STREQUAL "vtksys" AND
NOT _vtk_component STREQUAL "vtkjava")
string(SUBSTRING "${_vtk_component}" 3 -1 _vtk_actual_component)
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION)
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
message(DEPRECATION
"The new name for the '${_vtk_component}' component is "
"'${_vtk_actual_component}'")
endif ()
elseif (${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS 8.90)
# Ignore for compatibility.
else ()
message(FATAL_ERROR
"The new name for the '${_vtk_component}' component is "
"'${_vtk_actual_component}'. By requesting at least version 8.90, the "
"new component names are now required.")
endif ()
list(APPEND _vtk_real_components
"${_vtk_actual_component}")
list(APPEND _vtk_temp_variables
"${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_vtk_actual_component}")
set("${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_vtk_actual_component}"
"${${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_vtk_component}}")
unset(_vtk_actual_component)
else ()
list(APPEND _vtk_real_components
"${_vtk_component}")
endif ()
endforeach ()
unset(_vtk_component)
set("${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS"
${_vtk_real_components})
unset(_vtk_real_components)
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}/vtk-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" "@VTK_MAJOR_VERSION@.@VTK_MINOR_VERSION@.@VTK_BUILD_VERSION@")
set("${CMAKE_FIND_PACKAGE_NAME}_MAJOR_VERSION" "@VTK_MAJOR_VERSION@")
set("${CMAKE_FIND_PACKAGE_NAME}_MINOR_VERSION" "@VTK_MINOR_VERSION@")
set("${CMAKE_FIND_PACKAGE_NAME}_BUILD_VERSION" "@VTK_BUILD_VERSION@")
set("${CMAKE_FIND_PACKAGE_NAME}_LEGACY_REMOVE" "@VTK_LEGACY_REMOVE@")
set("${CMAKE_FIND_PACKAGE_NAME}_AUTOINIT_INCLUDE" "\"vtkAutoInit.h\"")
set("${CMAKE_FIND_PACKAGE_NAME}_SMP_BACKENDS" "@vtk_smp_backends@")
set("${CMAKE_FIND_PACKAGE_NAME}_AVAILABLE_COMPONENTS" "@vtk_all_components@")
unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND")
set("${CMAKE_FIND_PACKAGE_NAME}_HAS_VTKm" "@vtk_has_vtkm@")
if (${CMAKE_FIND_PACKAGE_NAME}_HAS_VTKm)
find_package(VTKm
PATHS "${CMAKE_CURRENT_LIST_DIR}/vtkm"
NO_DEFAULT_PATH)
if (NOT VTKm_FOUND)
set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
endif ()
endif ()
include("${CMAKE_CURRENT_LIST_DIR}/vtkCMakeBackports.cmake")
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}/vtk-find-package-helpers.cmake" OPTIONAL)
# Ensure that the right OpenGL preference is in place when finding the OpenGL
# libraries.
if (@vtk_opengl_preference_set@) # vtk_opengl_preference_set
set("${CMAKE_FIND_PACKAGE_NAME}_OPENGL_GL_PREFERENCE_save" "${OPENGL_GL_PREFERENCE}")
set(OPENGL_GL_PREFERENCE "@vtk_opengl_preference@")
endif ()
include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-find-packages.cmake")
if (@vtk_opengl_preference_set@) # vtk_opengl_preference_set
set(OPENGL_GL_PREFERENCE "${${CMAKE_FIND_PACKAGE_NAME}_OPENGL_GL_PREFERENCE_save}")
endif ()
if (TARGET VTK::opengl)
set(VTK_OPENGL_HAS_EGL "@VTK_OPENGL_HAS_EGL@")
endif ()
if (TARGET VTK::RenderingOpenVR)
set("${CMAKE_FIND_PACKAGE_NAME}_ENABLE_OPENVR_COLLABORATION" "@VTK_ENABLE_OPENVR_COLLABORATION@")
endif ()
if (@vtk_qt_major_version@) # VTK_QT_VERSION
set("${CMAKE_FIND_PACKAGE_NAME}_QT_VERSION" "@vtk_qt_major_version@")
endif ()
if (@vtk_has_qml@) # vtk_has_qml
set("${CMAKE_FIND_PACKAGE_NAME}_QML_DIR" "${${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH}/@CMAKE_INSTALL_QMLDIR@")
endif ()
include("${CMAKE_CURRENT_LIST_DIR}/vtkModule.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/vtkEncodeString.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/vtkHashSource.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/vtkObjectFactory.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/vtkModuleJson.cmake")
set("${CMAKE_FIND_PACKAGE_NAME}_PYTHON_VERSION" "@vtk_python_version@")
set("${CMAKE_FIND_PACKAGE_NAME}_WRAP_PYTHON" "@VTK_WRAP_PYTHON@")
if (${CMAKE_FIND_PACKAGE_NAME}_WRAP_PYTHON)
include("${CMAKE_CURRENT_LIST_DIR}/VTKPython-targets.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/vtkmodules-vtk-python-module-properties.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/vtkModuleWrapPython.cmake")
set("${CMAKE_FIND_PACKAGE_NAME}_PYTHONPATH" "@VTK_PYTHON_SITE_PACKAGES_SUFFIX@")
endif ()
set("${CMAKE_FIND_PACKAGE_NAME}_WRAP_JAVA" "@VTK_WRAP_JAVA@")
if (${CMAKE_FIND_PACKAGE_NAME}_WRAP_JAVA)
include("${CMAKE_CURRENT_LIST_DIR}/vtkModuleWrapJava.cmake")
if (@VTK_JAVA_JOGL_COMPONENT@) # VTK_JAVA_JOGL_COMPONENT
set(_vtk_find_jogl_args)
if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
list(APPEND _vtk_find_jogl_args QUIET)
endif ()
find_package(JOGL ${_vtk_find_jogl_args})
unset(_vtk_find_jogl_args)
if (JOGL_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/VTKJava-targets.cmake")
set("${CMAKE_FIND_PACKAGE_NAME}_vtkjava_FOUND" 1)
else ()
set("${CMAKE_FIND_PACKAGE_NAME}_vtkjava_FOUND" 0)
set("${CMAKE_FIND_PACKAGE_NAME}_vtkjava_NOT_FOUND_MESSAGE"
"JOGL was not found")
endif ()
endif ()
endif ()
set(_vtk_components_to_check)
foreach (_vtk_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND")
# It was already not-found (likely due to `find-package` failures).
elseif (TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}")
list(APPEND _vtk_components_to_check
"${_vtk_component}")
else ()
set("${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND" 0)
list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_NOT_FOUND_MESSAGE"
"The ${_vtk_component} component is not available.")
endif ()
endforeach ()
unset(_vtk_component)
while (_vtk_components_to_check)
list(GET _vtk_components_to_check 0 _vtk_component)
list(REMOVE_AT _vtk_components_to_check 0)
if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND")
# We've already made a determiniation.
continue ()
endif ()
get_property(_vtk_public_dependencies
TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}"
PROPERTY "INTERFACE_vtk_module_depends")
get_property(_vtk_private_dependencies
TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}"
PROPERTY "INTERFACE_vtk_module_private_depends")
get_property(_vtk_optional_dependencies
TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}"
PROPERTY "INTERFACE_vtk_module_optional_depends")
set(_vtk_dependencies
${_vtk_public_dependencies}
${_vtk_private_dependencies})
foreach (_vtk_optional_dependency IN LISTS _vtk_optional_dependencies)
if (TARGET "${_vtk_optional_dependency}")
list(APPEND _vtk_dependencies
"${_vtk_optional_dependency}")
endif ()
endforeach ()
unset(_vtk_public_dependencies)
unset(_vtk_private_dependencies)
unset(_vtk_optional_dependency)
unset(_vtk_optional_dependencies)
string(REPLACE "${CMAKE_FIND_PACKAGE_NAME}::" "" _vtk_dependencies "${_vtk_dependencies}")
set(_vtk_all_dependencies_checked TRUE)
foreach (_vtk_dependency IN LISTS _vtk_dependencies)
if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_dependency}_FOUND")
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_vtk_dependency}_FOUND)
set("${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND" 0)
list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_NOT_FOUND_MESSAGE"
"Failed to find the ${_vtk_dependency} component.")
endif ()
else ()
# Check its dependencies.
list(APPEND _vtk_components_to_check
"${_vtk_dependency}")
set(_vtk_all_found FALSE)
endif ()
endforeach ()
if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND")
if (_vtk_all_dependencies_checked)
set("${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND" 1)
else ()
list(APPEND _vtk_components_to_check
"${_vtk_component}")
endif ()
endif ()
unset(_vtk_all_dependencies_checked)
unset(_vtk_dependency)
unset(_vtk_dependencies)
endwhile ()
unset(_vtk_component)
unset(_vtk_components_to_check)
set(_vtk_missing_components)
foreach (_vtk_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND AND ${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_vtk_component})
list(APPEND _vtk_missing_components
"${_vtk_component}")
endif ()
endforeach ()
if (_vtk_missing_components)
list(REMOVE_DUPLICATES _vtk_missing_components)
list(SORT _vtk_missing_components)
string(REPLACE ";" ", " _vtk_missing_components "${_vtk_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: ${_vtk_missing_components}.")
endif ()
unset(_vtk_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)
set(_vtk_found_components
${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS})
if (NOT _vtk_found_components)
set(_vtk_found_components
${${CMAKE_FIND_PACKAGE_NAME}_AVAILABLE_COMPONENTS})
endif ()
list(REMOVE_ITEM _vtk_found_components
# This component needs to always be requested explicitly (it is not a
# module).
vtkjava)
# Build the `_LIBRARIES` variable.
foreach (_vtk_component IN LISTS _vtk_found_components)
if (TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}")
list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES"
"${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}")
endif ()
endforeach ()
unset(_vtk_component)
unset(_vtk_found_components)
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")
foreach (_vtk_temp_variable IN LISTS _vtk_temp_variables)
unset("${_vtk_temp_variable}")
endforeach ()
unset(_vtk_temp_variable)
unset(_vtk_temp_variables)
# Compatibility with old code.
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION)
set(VTK_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/vtk-use-file-deprecated.cmake")
elseif (${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS 8.90)
set(VTK_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/vtk-use-file-compat.cmake")
else ()
set(VTK_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/vtk-use-file-error.cmake")
endif ()
cmake_policy(POP)