paraview-config.cmake
Go to the documentation of this file.
1 #[==[.md
2 # paraview-config.cmake
3 
4 This file is used by CMake when finding ParaView.
5 
6 The following variables are provided by this module:
7 
8  * `ParaView_VERSION`: The full version of ParaView found.
9  * `ParaView_VERSION_SIMPLE`: The simple version of ParaView found (eg: 5.9.1).
10  * `ParaView_VERSION_MAJOR`: The major version of ParaView found.
11  * `ParaView_VERSION_MINOR`: The minor version of ParaView found.
12  * `ParaView_VERSION_PATCH`: The patch version of ParaView found.
13  * `ParaView_PREFIX_PATH`: Install prefix for ParaView.
14  * `PARAVIEW_USE_QT`: If ParaView's Qt GUI is available.
15  * `PARAVIEW_QT_MAJOR_VERSION`: Major version of Qt used by ParaView if PARAVIEW_USE_QT is TRUE
16  * `PARAVIEW_USE_MPI`: If ParaView is built with MPI support.
17  * `PARAVIEW_USE_PYTHON`: If ParaView is built with Python support.
18  * `PARAVIEW_USE_SERIALIZATION`: If ParaView is built with Serialization support.
19  * `PARAVIEW_USE_QTWEBENGINE`: If ParaView uses Qt's WebEngine for its help.
20  * `PARAVIEW_PYTHONPATH`: Where ParaView's Python modules live under the
21  install prefix. Unset if Python is not available.
22  * `PARAVIEW_PLUGIN_SUBDIR`: The subdirectory under the library directory for
23  plugins.
24  * `ParaView_CLIENT_XML_FILES`: XML files for client applications to use to
25  reproduce ParaView's menu items. Only provided if `PARAVIEW_USE_QT`
26  is set.
27  * `ParaView_LIBRARIES`: The list of modules specified by `COMPONENTS` and
28  `OPTIONAL_COMPONENTS`. This may be used in `MODULES` arguments in the API
29  (e.g., `vtk_module_autoinit`). All modules are also targets and may be
30  linked to using `target_link_libraries`.
31  * `ParaView_CATALYST_DIR`: The directory to the ParaView Catalyst
32  implementation (if present).
33 #]==]
34 
35 if (CMAKE_VERSION VERSION_LESS "3.12")
36  set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
37  set("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE"
38  "ParaView requires CMake 3.12 in order to reliably be used.")
39  return ()
40 endif ()
41 
42 cmake_policy(PUSH)
43 cmake_policy(VERSION 3.12)
44 
45 set(${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save "${CMAKE_MODULE_PATH}")
46 list(INSERT CMAKE_MODULE_PATH 0
47  "${CMAKE_CURRENT_LIST_DIR}")
48 
49 set("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save" "${CMAKE_PREFIX_PATH}")
50 include("${CMAKE_CURRENT_LIST_DIR}/paraview-prefix.cmake")
51 set("${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH"
52  "${_vtk_module_import_prefix}")
53 unset(_vtk_module_import_prefix)
54 list(INSERT CMAKE_PREFIX_PATH 0
55  "${${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH}")
56 
57 set("${CMAKE_FIND_PACKAGE_NAME}_VERSION" "5.13.3-2-g22fe491f25")
58 set("${CMAKE_FIND_PACKAGE_NAME}_VERSION_SIMPLE" "5.13")
59 set("${CMAKE_FIND_PACKAGE_NAME}_VERSION_MAJOR" "5")
60 set("${CMAKE_FIND_PACKAGE_NAME}_VERSION_MINOR" "13")
61 set("${CMAKE_FIND_PACKAGE_NAME}_VERSION_PATCH" "3")
62 
63 unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND")
64 
65 set(_paraview_use_external_vtk "OFF")
66 set(_paraview_find_package_args)
67 if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
68  list(APPEND _paraview_find_package_args
69  QUIET)
70 endif ()
71 if (NOT _paraview_use_external_vtk)
72  list(APPEND _paraview_find_package_args
73  PATHS "${CMAKE_CURRENT_LIST_DIR}/vtk"
74  NO_DEFAULT_PATH)
75  # Find VTK with just `CommonCore` to get the available targets first. Only
76  # required for a vendored VTK since external targets are not checked by CMake
77  # later.
78  find_package(VTK REQUIRED
79  ${_paraview_find_package_args}
80  COMPONENTS CommonCore)
81 endif ()
82 unset(_paraview_use_external_vtk)
83 
84 set(PARAVIEW_USE_QT "ON")
85 set(PARAVIEW_QT_MAJOR_VERSION "5")
86 set(PARAVIEW_USE_MPI "ON")
87 set(PARAVIEW_USE_PYTHON "ON")
88 set(PARAVIEW_USE_SERIALIZATION "OFF")
89 set(PARAVIEW_USE_QTWEBENGINE "OFF")
90 set(PARAVIEW_PLUGIN_SUBDIR "paraview-5.13/plugins")
91 
92 if (PARAVIEW_USE_PYTHON)
93  set(PARAVIEW_PYTHONPATH "lib64/python3.10/site-packages")
94  include("${CMAKE_CURRENT_LIST_DIR}/ParaViewPython-targets.cmake")
95  include("${CMAKE_CURRENT_LIST_DIR}/ParaViewPythonIncubator-targets.cmake")
96  # Unset this for now; these targets will be defined later.
97  unset("${CMAKE_FIND_PACKAGE_NAME}_FOUND")
98  unset("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE")
99 endif ()
100 
101 include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-targets.cmake")
102 include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-properties.cmake")
103 
104 include("${CMAKE_CURRENT_LIST_DIR}/paraview-find-package-helpers.cmake" OPTIONAL)
105 include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}-vtk-module-find-packages.cmake")
106 
107 if ("INCUBATOR" IN_LIST "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
108  list(REMOVE_ITEM "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS"
109  INCUBATOR)
110  # This component is always found.
111  set("${CMAKE_FIND_PACKAGE_NAME}_INCUBATOR_FOUND" 1)
112 
113  include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Incubator-targets.cmake")
114  include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Incubator-vtk-module-properties.cmake")
115  include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Incubator-vtk-module-find-packages.cmake")
116 else ()
117  include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Incubator-targets.cmake")
118 
119  set("${CMAKE_FIND_PACKAGE_NAME}_INCUBATOR_FOUND" 0)
120  set("${CMAKE_FIND_PACKAGE_NAME}_INCUBATOR_NOT_FOUND_MESSAGE" "the `INCUBATOR` component was not requested")
121 endif ()
122 
123 include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-paraview_plugins-targets-depends.cmake")
124 include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-targets.cmake")
125 include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Plugins-paraview-plugin-properties.cmake")
126 
127 include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Clients-targets.cmake")
128 include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Clients-vtk-module-properties.cmake")
129 
130 include("${CMAKE_CURRENT_LIST_DIR}/ParaViewTools-targets.cmake" OPTIONAL)
131 
132 # Gather the list of required VTK components.
133 set(_paraview_vtk_components_to_request_required)
134 set(_paraview_vtk_components_to_request_optional)
135 if (${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS)
136  set(_paraview_search_components
137  "${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS}")
138 else ()
139  set(_paraview_search_components
140  "WrapClientServer;smTestDriver;PythonInterpreterPath;PythonInitializer;ProcessXML;CinemaSci;CinemaPython;icet;RemotingViewsPython;RemotingServerManagerPython;PVWebPython;VTKExtensionsPoints;VTKExtensionsIOSPCTH;VTKExtensionsIOParallelCGNSWriter;VTKExtensionsIOImage;VTKExtensionsIOExodus;VTKExtensionsIOEnSight;VTKExtensionsIOCGNSWriter;VTKExtensionsIOAMR;VTKExtensionsFiltersStatistics;VTKExtensionsFiltersPython;VTKExtensionsFiltersParallelDIY2;VTKExtensionsFiltersParallel;VTKExtensionsFiltersMaterialInterface;VTKExtensionsFiltersGeneralMPI;VTKExtensionsFiltersFlowPaths;VTKExtensionsExtractionPython;pqPython;pqApplicationComponents;RemotingImport;VTKExtensionsIOImport;RemotingExport;pqComponents;RemotingLive;pqCore;RemotingMisc;VTKExtensionsIOGeneral;VTKExtensionsFiltersGeneral;VTKExtensionsAMR;RemotingApplication;RemotingSettings;RemotingAnimation;VTKExtensionsIOCore;RemotingViews;VTKExtensionsInteractionStyle;VTKExtensionsFiltersRendering;VTKExtensionsMisc;VTKExtensionsExtraction;pqWidgets;RemotingServerManager;protobuf;RemotingCore;VTKExtensionsCore;RemotingClientServerStream;Versioning;qttesting;AdaptorsPython;AdaptorsPhasta;AdaptorsParticle;AdaptorsPagosa;AdaptorsNPIC;AdaptorsCamPython;AdaptorsCam;AdaptorsCTH;ClientsWeb;PythonCatalyst;InSitu;Catalyst")
141 endif ()
142 foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
143  # Ignore non-existent components here.
144  if (NOT TARGET "ParaView::${_paraview_component}")
145  continue ()
146  endif ()
147 
148  # Get all module dependencies.
149  get_property(_paraview_component_depends
150  TARGET "ParaView::${_paraview_component}"
151  PROPERTY "INTERFACE_vtk_module_depends")
152  get_property(_paraview_component_private_depends
153  TARGET "ParaView::${_paraview_component}"
154  PROPERTY "INTERFACE_vtk_module_private_depends")
155  get_property(_paraview_component_optional_depends
156  TARGET "ParaView::${_paraview_component}"
157  PROPERTY "INTERFACE_vtk_module_optional_depends")
158 
159  # Keep only VTK dependencies.
160  set(_paraview_component_vtk_depends
161  ${_paraview_component_depends}
162  ${_paraview_component_private_depends})
163  set(_paraview_component_vtk_optional_depends
164  ${_paraview_component_optional_depends})
165  list(FILTER _paraview_component_vtk_depends INCLUDE REGEX "^VTK::")
166  list(FILTER _paraview_component_vtk_optional_depends INCLUDE REGEX "^VTK::")
167  string(REPLACE "VTK::" "" _paraview_component_vtk_depends "${_paraview_component_vtk_depends}")
168  string(REPLACE "VTK::" "" _paraview_component_vtk_optional_depends "${_paraview_component_vtk_optional_depends}")
169  if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_paraview_component})
170  list(APPEND _paraview_vtk_components_to_request_required
171  ${_paraview_component_vtk_depends})
172  else ()
173  list(APPEND _paraview_vtk_components_to_request_optional
174  ${_paraview_component_vtk_depends})
175  endif ()
176  list(APPEND _paraview_vtk_components_to_request_optional
177  ${_paraview_component_vtk_optional_depends})
178 endforeach ()
179 unset(_paraview_component)
180 unset(_paraview_component_depends)
181 unset(_paraview_component_private_depends)
182 unset(_paraview_component_optional_depends)
183 unset(_paraview_component_vtk_optional_depends)
184 unset(_paraview_component_vtk_depends)
185 
186 # Remove duplicate component requests.
187 if (_paraview_vtk_components_to_request_required)
188  list(REMOVE_DUPLICATES _paraview_vtk_components_to_request_required)
189 endif ()
190 if (_paraview_vtk_components_to_request_optional)
191  list(REMOVE_DUPLICATES _paraview_vtk_components_to_request_optional)
192 endif ()
193 # Modules which are required should be removed from the optional component
194 # list.
195 if (_paraview_vtk_components_to_request_required)
196  list(REMOVE_ITEM _paraview_vtk_components_to_request_optional
197  ${_paraview_vtk_components_to_request_required})
198 endif()
199 
200 # Now find VTK with all of the components we require.
201 find_package(VTK REQUIRED
202  ${_paraview_find_package_args}
203  COMPONENTS ${_paraview_vtk_components_to_request_required}
204  OPTIONAL_COMPONENTS ${_paraview_vtk_components_to_request_optional})
205 if (NOT VTK_FOUND)
206  set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
207 endif ()
208 unset(_paraview_find_package_args)
209 unset(_paraview_vtk_components_to_request_required)
210 unset(_paraview_vtk_components_to_request_optional)
211 
212 include("${CMAKE_CURRENT_LIST_DIR}/ParaViewClient.cmake")
213 include("${CMAKE_CURRENT_LIST_DIR}/ParaViewPlugin.cmake")
214 include("${CMAKE_CURRENT_LIST_DIR}/ParaViewServerManager.cmake")
215 include("${CMAKE_CURRENT_LIST_DIR}/ParaViewTesting.cmake")
216 include("${CMAKE_CURRENT_LIST_DIR}/vtkModuleWrapClientServer.cmake")
217 
218 include("${CMAKE_CURRENT_LIST_DIR}/ParaViewTranslations.cmake")
219 
220 if (0) # paraview_has_catalyst
221  set("${CMAKE_FIND_PACKAGE_NAME}_CATALYST_DIR"
222  "${${CMAKE_FIND_PACKAGE_NAME}_PREFIX_PATH}/")
223 endif ()
224 
225 if (ON) # PARAVIEW_USE_PYTHON
226  include("${CMAKE_CURRENT_LIST_DIR}/paraview.modules-vtk-python-module-properties.cmake")
227 
228  if(${CMAKE_FIND_PACKAGE_NAME}_INCUBATOR_FOUND)
229  include("${CMAKE_CURRENT_LIST_DIR}/paraview.incubator-vtk-python-module-properties.cmake")
230  endif ()
231 endif ()
232 
233 if (ON) # PARAVIEW_USE_QT
234  include("${CMAKE_CURRENT_LIST_DIR}/${CMAKE_FIND_PACKAGE_NAME}Client-targets.cmake")
235  include("${CMAKE_CURRENT_LIST_DIR}/ParaView-client-xml.cmake")
236 endif ()
237 
238 set(_paraview_components_to_check)
239 foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
240  if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND")
241  # It was already not-found (likely due to `find-package` failures).
242  elseif (TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}")
243  list(APPEND _paraview_components_to_check
244  "${_paraview_component}")
245  else ()
246  set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0)
247  list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE"
248  "The ${_paraview_component} component is not available.")
249  endif ()
250 endforeach ()
251 unset(_paraview_component)
252 
253 set(_paraview_vtk_components)
254 
255 while (_paraview_components_to_check)
256  list(GET _paraview_components_to_check 0 _paraview_component)
257  list(REMOVE_AT _paraview_components_to_check 0)
258  if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND")
259  # We've already made a determiniation.
260  continue ()
261  endif ()
262 
263  get_property(_paraview_dependencies
264  TARGET "${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}"
265  PROPERTY "INTERFACE_paraview_module_depends")
266  string(REPLACE "${CMAKE_FIND_PACKAGE_NAME}::" "" _paraview_dependencies "${_paraview_dependencies}")
267  set(_paraview_all_dependencies_checked TRUE)
268  foreach (_paraview_dependency IN LISTS _paraview_dependencies)
269  # Handle VTK module dependencies.
270  string(FIND "${_paraview_component}" "VTK::" _paraview_vtk_idx)
271  if (NOT _paraview_vtk_idx EQUAL -1)
272  unset(_paraview_vtk_idx)
273  if (NOT TARGET "${_paraview_dependency}")
274  set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0)
275  list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE"
276  "Failed to find the ${_paraview_dependency} module.")
277  endif ()
278  continue ()
279  endif ()
280  unset(_paraview_vtk_idx)
281 
282  if (DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_dependency}_FOUND")
283  if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_paraview_dependency}_FOUND)
284  set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 0)
285  list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_NOT_FOUND_MESSAGE"
286  "Failed to find the ${_paraview_dependency} component.")
287  endif ()
288  else ()
289  # Check its dependencies.
290  list(APPEND _paraview_components_to_check
291  "${_paraview_dependency}")
292  set(_paraview_all_found FALSE)
293  endif ()
294  endforeach ()
295  if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND")
296  if (_paraview_all_dependencies_checked)
297  set("${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND" 1)
298  else ()
299  list(APPEND _paraview_components_to_check
300  "${_paraview_component}")
301  endif ()
302  endif ()
303  unset(_paraview_all_dependencies_checked)
304  unset(_paraview_dependency)
305  unset(_paraview_dependencies)
306 endwhile ()
307 unset(_paraview_component)
308 unset(_paraview_components_to_check)
309 
310 set(_paraview_missing_components)
311 foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
312  if (NOT ${CMAKE_FIND_PACKAGE_NAME}_${_paraview_component}_FOUND AND ${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_${_paraview_component})
313  list(APPEND _paraview_missing_components
314  "${_paraview_component}")
315  endif ()
316 endforeach ()
317 
318 if (_paraview_missing_components)
319  list(REMOVE_DUPLICATES _paraview_missing_components)
320  list(SORT _paraview_missing_components)
321  string(REPLACE ";" ", " _paraview_missing_components "${_paraview_missing_components}")
322  set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
323  set("${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE"
324  "Could not find the ${CMAKE_FIND_PACKAGE_NAME} package with the following required components: ${_paraview_missing_components}.")
325 endif ()
326 unset(_paraview_missing_components)
327 
328 set("${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES")
329 if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_FOUND")
330  # If nothing went wrong, we've successfully found the package.
331  set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 1)
332  # Build the `_LIBRARIES` variable.
333  foreach (_paraview_component IN LISTS "${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS")
334  list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES"
335  "${CMAKE_FIND_PACKAGE_NAME}::${_paraview_component}")
336  endforeach ()
337  unset(_paraview_component)
338 endif ()
339 
340 set(CMAKE_PREFIX_PATH "${${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save}")
341 unset("${CMAKE_FIND_PACKAGE_NAME}_CMAKE_PREFIX_PATH_save")
342 
343 set(CMAKE_MODULE_PATH "${${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save}")
344 unset(${CMAKE_FIND_PACKAGE_NAME}_CMAKE_MODULE_PATH_save)
345 
346 # Compatibility with old code.
347 if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION)
348  set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-deprecated.cmake")
349 elseif (${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS 5.7)
350  set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-compat.cmake")
351 else ()
352  set(PARAVIEW_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/paraview-use-file-error.cmake")
353 endif ()
354 
355 # 5.8 renamed these variables, so provide them if 5.8 is not the minimum
356 # requested.
357 if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION OR
358  ${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION VERSION_LESS "5.8")
359  set(PARAVIEW_BUILD_QT_GUI "${PARAVIEW_USE_QT}")
360  set(PARAVIEW_ENABLE_PYTHON "${PARAVIEW_USE_PYTHON}")
361 endif ()
362 
363 cmake_policy(POP)
component
version
#define VERSION
Definition: jconfigint.h:17