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