4 This file is used by CMake when finding VTK. It provides the [VTK module
5 API][] as well as some VTK-specific APIs.
7 The following variables are provided by
this module:
13 * `VTK_AVAILABLE_COMPONENTS`: Components available with VTK.
14 * `VTK_PREFIX_PATH`: Install prefix
for VTK.
15 * `VTK_LEGACY_REMOVE`: Whether VTK
's deprecated APIs are 17 * `VTK_HAS_VTKm`: If VTK provides VTK-m. 18 * `VTK_OPENGL_HAS_EGL`: If VTK::opengl uses EGL. Only provided if the 19 `VTK::opengl` target exists. 20 * `VTK_PYTHON_VERSION`: The major version of Python used by VTK. Empty if 21 Python support is not available. 22 * `VTK_WRAP_PYTHON`: If VTK itself provides Python wrapping. If so, the 23 Python parts of the module API are available. 24 * `VTK_WRAP_JAVA`: If VTK itself provides Java wrapping. If so, the 25 Java parts of the module API are available. 26 * `VTK_PYTHONPATH`: Where VTK's Python modules live inside the install
27 prefix. Unset
if Python is not available.
28 * `VTK_LIBRARIES`: The list of modules specified by `COMPONENTS` and
29 `OPTIONAL_COMPONENTS`. However,
if no components are specified, all
30 available components are added to
this variable. This may be used in
32 are also targets and may be linked to
using `target_link_libraries`.
33 * `VTK_AUTOINIT_INCLUDE`: The header to include
for access to VTK
's autoinit 36 For more information about the Python in use by VTK, the `VTK_PYTHON_VERSION` 37 variable may be used to query the `find_package(Python)` that VTK performs 38 internally (note that the `Python` component must be found to guarantee that 39 this happens). For example, the following information would be useful: 41 - the `Python${VTK_PYTHON_VERSION}_VERSION` variable; and 42 - the `Python${VTK_PYTHON_VERSION}::Python` target. 44 See [FindPython2][] and [FindPython3][] documentation for all of the available 47 [FindPython2]: https://cmake.org/cmake/help/v3.13/module/FindPython2.html 48 [FindPython3]: https://cmake.org/cmake/help/v3.13/module/FindPython3.html 49 [VTK module API]: TODO: Link to hosted documentation. 52 if (CMAKE_VERSION VERSION_LESS "3.12") 53 set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0) 54 set("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE" 55 "VTK requires CMake 3.12 in order to reliably be used.") 60 cmake_policy(VERSION 3.12) 62 set(_vtk_temp_variables) 63 set(_vtk_real_components) 64 foreach (_vtk_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS") 65 if (_vtk_component MATCHES "^vtk" AND 66 NOT _vtk_component STREQUAL "vtksys" AND 67 NOT _vtk_component STREQUAL "vtkjava") 68 string(SUBSTRING "${_vtk_component}" 3 -1 _vtk_actual_component) 69 if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION) 70 if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) 72 "The new name for the '${_vtk_component}
' component is " 73 "'${_vtk_actual_component}
'") 75 elseif (${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS 8.90) 76 # Ignore for compatibility. 79 "The new name for the '${_vtk_component}
' component is " 80 "'${_vtk_actual_component}
'. By requesting at least version 8.90, the " 81 "new component names are now required.") 83 list(APPEND _vtk_real_components 84 "${_vtk_actual_component}") 85 list(APPEND _vtk_temp_variables 86 "${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_vtk_actual_component}") 87 set("${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_vtk_actual_component}" 88 "${${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_vtk_component}}") 89 unset(_vtk_actual_component) 91 list(APPEND _vtk_real_components 96 set("${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS" 97 ${_vtk_real_components}) 98 unset(_vtk_real_components) 100 set("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save" "${CMAKE_MODULE_PATH}") 101 list(INSERT CMAKE_MODULE_PATH 0 102 "${CMAKE_CURRENT_LIST_DIR}") 104 set("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save" "${CMAKE_PREFIX_PATH}") 105 include("${CMAKE_CURRENT_LIST_DIR}/vtk-prefix.cmake") 106 set("${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH" 107 "${_vtk_module_import_prefix}") 108 unset(_vtk_module_import_prefix) 109 list(INSERT CMAKE_PREFIX_PATH 0 110 "${${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH}") 112 set("${CMAKE_FIND_PACKAGE_NAME}_VERSION" "9.0.20201030") 113 set("${CMAKE_FIND_PACKAGE_NAME}_MAJOR_VERSION" "9") 114 set("${CMAKE_FIND_PACKAGE_NAME}_MINOR_VERSION" "0") 115 set("${CMAKE_FIND_PACKAGE_NAME}_BUILD_VERSION" "20201030") 116 set("${CMAKE_FIND_PACKAGE_NAME}_LEGACY_REMOVE" "OFF") 117 set("${CMAKE_FIND_PACKAGE_NAME}_AUTOINIT_INCLUDE" "\"vtkAutoInit.h\"") 119 set("${CMAKE_FIND_PACKAGE_NAME}_AVAILABLE_COMPONENTS" "WrappingTools;WebPython;WebCore;WebGLExporter;IOExport;InteractionWidgets;ViewsContext2D;loguru;TestingRendering;TestingCore;RenderingVolumeAMR;RenderingVolumeOpenGL2;RenderingParallel;ImagingMath;RenderingMatplotlib;PythonInterpreter;RenderingLabel;octree;RenderingLICOpenGL2;RenderingContextOpenGL2;ParallelMPI4Py;mpi4py;IOXdmf2;IOXMLParser;libxml2;xdmf2;IOVeraOut;IOVPIC;vpic;IOTecplotTable;IOTRUCHAS;IOSegY;IOParallelXML;IOParallelNetCDF;IOParallelLSDyna;IOLSDyna;IOParallelExodus;IOExodus;exodusII;IOPLY;IOPIO;IOOggTheora;theora;ogg;IONetCDF;IOParallel;IOMPIImage;IOIoss;ioss;IOInfovis;InfovisCore;IOImport;IOH5part;h5part;IOGeometry;IOMovie;IOExportGL2PS;RenderingGL2PSOpenGL2;gl2ps;png;RenderingVtkJS;libharu;RenderingSceneGraph;jsoncpp;netcdf;IOEnSight;IOCityGML;IOCONVERGECFD;IOAsynchronous;IOAMR;hdf5;ViewsCore;RenderingUI;GUISupportQt;ImagingColor;RenderingVolume;RenderingAnnotation;InteractionStyle;ImagingHybrid;FiltersPython;FiltersProgrammable;FiltersPoints;FiltersParallelVerdict;FiltersVerdict;verdict;FiltersParallelStatistics;FiltersParallelGeometry;FiltersParallelFlowPaths;FiltersParallelDIY2;ParallelDIY;ImagingGeneral;FiltersHyperTree;FiltersGeneric;FiltersFlowPaths;eigen;FiltersAMR;FiltersParallelMPI;FiltersParallel;FiltersTexture;FiltersModeling;FiltersHybrid;ParallelMPI;mpi;DomainsChemistryOpenGL2;RenderingOpenGL2;glew;opengl;DomainsChemistry;WrappingPythonCore;Python;ChartsCore;FiltersExtraction;diy2;IOXML;expat;ParallelCore;IOLegacy;IOCore;lzma;utf8;lz4;doubleconversion;FiltersStatistics;ImagingFourier;ImagingSources;IOImage;DICOMParser;jpeg;metaio;tiff;RenderingContext2D;RenderingFreeType;freetype;kwiml;zlib;RenderingCore;FiltersSources;CommonColor;AcceleratorsVTKmFilters;AcceleratorsVTKmCore;AcceleratorsVTKmDataModel;ImagingCore;FiltersGeometry;FiltersGeneral;CommonComputationalGeometry;FiltersCore;CommonExecutionModel;vtkm;CommonDataModel;pugixml;CommonSystem;CommonMisc;CommonTransforms;CommonMath;CommonCore;vtksys") 121 unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND") 122 set("${CMAKE_FIND_PACKAGE_NAME}_HAS_VTKm" "ON") 123 if (${CMAKE_FIND_PACKAGE_NAME}_HAS_VTKm) 125 PATHS "${CMAKE_CURRENT_LIST_DIR}/vtkm" 128 set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0) 132 include("${CMAKE_CURRENT_LIST_DIR}/vtkCMakeBackports.cmake") 133 include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-targets.cmake") 134 include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-properties.cmake") 136 include("${CMAKE_CURRENT_LIST_DIR}/vtk-find-package-helpers.cmake" OPTIONAL) 138 include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-find-packages.cmake") 140 if (TARGET VTK::opengl) 141 set(VTK_OPENGL_HAS_EGL "OFF") 144 include("${CMAKE_CURRENT_LIST_DIR}/vtkModule.cmake") 145 include("${CMAKE_CURRENT_LIST_DIR}/vtkEncodeString.cmake") 146 include("${CMAKE_CURRENT_LIST_DIR}/vtkHashSource.cmake") 147 include("${CMAKE_CURRENT_LIST_DIR}/vtkObjectFactory.cmake") 149 include("${CMAKE_CURRENT_LIST_DIR}/vtkModuleJson.cmake") 151 set("${CMAKE_FIND_PACKAGE_NAME}_PYTHON_VERSION" "3") 152 set("${CMAKE_FIND_PACKAGE_NAME}_WRAP_PYTHON" "ON") 153 if (${CMAKE_FIND_PACKAGE_NAME}_WRAP_PYTHON) 154 include("${CMAKE_CURRENT_LIST_DIR}/VTKPython-targets.cmake") 155 include("${CMAKE_CURRENT_LIST_DIR}/vtkmodules-vtk-python-module-properties.cmake") 156 include("${CMAKE_CURRENT_LIST_DIR}/vtkModuleWrapPython.cmake") 157 set("${CMAKE_FIND_PACKAGE_NAME}_PYTHONPATH" "lib64/python3.9/site-packages") 160 set("${CMAKE_FIND_PACKAGE_NAME}_WRAP_JAVA" "") 161 if (${CMAKE_FIND_PACKAGE_NAME}_WRAP_JAVA) 162 include("${CMAKE_CURRENT_LIST_DIR}/vtkModuleWrapJava.cmake") 164 if () # VTK_JAVA_JOGL_COMPONENT 165 set(_vtk_find_jogl_args) 166 if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) 167 list(APPEND _vtk_find_jogl_args QUIET) 169 find_package(JOGL ${_vtk_find_jogl_args}) 170 unset(_vtk_find_jogl_args) 173 include("${CMAKE_CURRENT_LIST_DIR}/VTKJava-targets.cmake") 174 set("${CMAKE_FIND_PACKAGE_NAME}_vtkjava_FOUND" 1) 176 set("${CMAKE_FIND_PACKAGE_NAME}_vtkjava_FOUND" 0) 177 set("${CMAKE_FIND_PACKAGE_NAME}_vtkjava_NOT_FOUND_MESSAGE" 178 "JOGL was not found") 183 set(_vtk_components_to_check) 184 foreach (_vtk_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS") 185 if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND") 186 # It was already not-found (likely due to `find-package` failures). 187 elseif (TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}") 188 list(APPEND _vtk_components_to_check 191 set("${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND" 0) 192 list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_NOT_FOUND_MESSAGE" 193 "The ${_vtk_component} component is not available.") 196 unset(_vtk_component) 198 while (_vtk_components_to_check) 199 list(GET _vtk_components_to_check 0 _vtk_component) 200 list(REMOVE_AT _vtk_components_to_check 0) 201 if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND") 202 # We've already made a determiniation.
206 get_property(_vtk_public_dependencies
207 TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}
" 208 PROPERTY "INTERFACE_vtk_module_depends
") 209 get_property(_vtk_private_dependencies 210 TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}
" 211 PROPERTY "INTERFACE_vtk_module_private_depends
") 212 get_property(_vtk_optional_dependencies 213 TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}
" 214 PROPERTY "INTERFACE_vtk_module_optional_depends
") 215 set(_vtk_dependencies 216 ${_vtk_public_dependencies} 217 ${_vtk_private_dependencies}) 218 foreach (_vtk_optional_dependency IN LISTS _vtk_optional_dependencies) 219 if (TARGET "${_vtk_optional_dependency}
") 220 list(APPEND _vtk_dependencies 221 "${_vtk_optional_dependency}
") 224 unset(_vtk_public_dependencies) 225 unset(_vtk_private_dependencies) 226 unset(_vtk_optional_dependency) 227 unset(_vtk_optional_dependencies) 229 string(REPLACE "${CMAKE_FIND_PACKAGE_NAME}::
" "" _vtk_dependencies "${_vtk_dependencies}
") 230 set(_vtk_all_dependencies_checked TRUE) 231 foreach (_vtk_dependency IN LISTS _vtk_dependencies) 232 if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_dependency}_FOUND
") 233 if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_vtk_dependency}_FOUND) 234 set("${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND
" 0) 235 list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_NOT_FOUND_MESSAGE
" 236 "Failed to find the ${_vtk_dependency}
component.
") 239 # Check its dependencies. 240 list(APPEND _vtk_components_to_check 241 "${_vtk_dependency}
") 242 set(_vtk_all_found FALSE) 245 if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND
") 246 if (_vtk_all_dependencies_checked) 247 set("${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND
" 1) 249 list(APPEND _vtk_components_to_check 253 unset(_vtk_all_dependencies_checked) 254 unset(_vtk_dependency) 255 unset(_vtk_dependencies) 257 unset(_vtk_component) 258 unset(_vtk_components_to_check) 260 set(_vtk_missing_components) 261 foreach (_vtk_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS
") 262 if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_vtk_component}_FOUND AND ${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_vtk_component}) 263 list(APPEND _vtk_missing_components 268 if (_vtk_missing_components) 269 list(REMOVE_DUPLICATES _vtk_missing_components) 270 list(SORT _vtk_missing_components) 271 string(REPLACE ";
" ",
" _vtk_missing_components "${_vtk_missing_components}
") 272 set("${CMAKE_FIND_PACKAGE_NAME}_FOUND
" 0) 273 set("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
" 274 "Could not find the ${CMAKE_FIND_PACKAGE_NAME}
package with the following required components: ${_vtk_missing_components}.")
276 unset(_vtk_missing_components)
278 set("${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES")
279 if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_FOUND")
280 # If nothing went wrong, we've successfully found the package.
281 set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 1)
282 set(_vtk_found_components
283 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS})
284 if (NOT _vtk_found_components)
285 set(_vtk_found_components
286 ${${CMAKE_FIND_PACKAGE_NAME}_AVAILABLE_COMPONENTS})
288 list(REMOVE_ITEM _vtk_found_components
289 # This component needs to always be requested explicitly (it is not a
292 # Build the `_LIBRARIES` variable.
293 foreach (_vtk_component IN LISTS _vtk_found_components)
294 list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES"
295 "${CMAKE_FIND_PACKAGE_NAME}::${_vtk_component}")
297 unset(_vtk_component)
298 unset(_vtk_found_components)
301 set(CMAKE_PREFIX_PATH "${${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save}")
302 unset("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save")
304 set(CMAKE_MODULE_PATH "${${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save}")
305 unset("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save")
307 foreach (_vtk_temp_variable IN LISTS _vtk_temp_variables)
308 unset("${_vtk_temp_variable}")
310 unset(_vtk_temp_variable)
311 unset(_vtk_temp_variables)
313 # Compatibility with old code.
314 if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION)
315 set(VTK_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/vtk-use-file-deprecated.cmake")
316 elseif (${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS 8.90)
317 set(VTK_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/vtk-use-file-compat.cmake")
319 set(VTK_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/vtk-use-file-error.cmake")
#define VTK_BUILD_VERSION
#define VTK_MAJOR_VERSION
#define VTK_MINOR_VERSION
function vtk_module_autoinit()
Linking to autoinit-using modules.