ParaViewClient.cmake
Go to the documentation of this file.
1 set(_ParaViewClient_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
2 set(_ParaViewClient_script_file "${CMAKE_CURRENT_LIST_FILE}")
3 
4 #[==[.md
5 ## Building a client
6 
7 TODO: Document
8 
9 ```
11  NAME <name>
12  VERSION <version>
13  SOURCES <source>...
14  [APPLICATION_XMLS <xml>...]
15  [QCH_FILES <file>...]
16 
17  [MAIN_WINDOW_CLASS <class>]
18  [MAIN_WINDOW_INCLUDE <include>]
19 
20  [PLUGINS_TARGETS <target>...]
21  [REQUIRED_PLUGINS <plugin>...]
22  [OPTIONAL_PLUGINS <plugin>...]
23 
24  [APPLICATION_NAME <name>]
25  [ORGANIZATION <organization>]
26  [TITLE <title>]
27 
28  [DEFAULT_STYLE <style>]
29 
30  [APPLICATION_ICON <icon>]
31  [BUNDLE_ICON <icon>]
32  [BUNDLE_PLIST <plist>]
33  [SPLASH_IMAGE <image>]
34 
35  [NAMESPACE <namespace>]
36  [EXPORT <export>]
37  [FORCE_UNIX_LAYOUT <ON|OFF>]
38  [BUNDLE_DESTINATION <directory>]
39  [RUNTIME_DESTINATION <directory>]
40  [LIBRARY_DESTINATION <directory>])
41 ```
42 
43  * `NAME`: (Required) The name of the application. This is used as the target
44  name as well.
45  * `VERSION`: (Required) The version of the application.
46  * `SOURCES`: (Required) Source files for the application.
47  * `APPLICATION_XMLS`: Server manager XML files.
48  * `QCH_FILES`: Any `.qch` files containing documentation.
49  * `MAIN_WINDOW_CLASS`: (Defaults to `QMainWindow`) The name of the main
50  window class.
51  * `MAIN_WINDOW_INCLUDE`: (Defaults to `QMainWindow` or
52  `<MAIN_WINDOW_CLASS>.h` if it is specified) The include file for the main
53  window.
54  * `PLUGINS_TARGETS`: The targets for plugins. The associated functions
55  will be called upon startup.
56  * `REQUIRED_PLUGINS`: Plugins to load upon startup.
57  * `OPTIONAL_PLUGINS`: Plugins to load upon startup if available.
58  * `APPLICATION_NAME`: (Defaults to `<NAME>`) The displayed name of the
59  application.
60  * `ORGANIZATION`: (Defaults to `Anonymous`) The organization for the
61  application. This is used for the macOS GUI identifier.
62  * `TITLE`: The window title for the application.
63  * `DEFAULT_STYLE`: The default Qt style for the application.
64  * `APPLICATION_ICON`: The path to the icon for the Windows application.
65  * `BUNDLE_ICON`: The path to the icon for the macOS bundle.
66  * `BUNDLE_PLIST`: The path to the `Info.plist.in` template.
67  * `SPLASH_IMAGE`: The image to display upon startup.
68  * `NAMESPACE`: If provided, an alias target `<NAMESPACE>::<NAME>` will be
69  created.
70  * `EXPORT`: If provided, the target will be exported.
71  * `FORCE_UNIX_LAYOUT`: (Defaults to `OFF`) Forces a Unix-style layout even on
72  platforms for which they are not the norm for GUI applications (e.g.,
73  macOS).
74  * `BUNDLE_DESTINATION`: (Defaults to `Applications`) Where to place the
75  bundle executable.
76  * `RUNTIME_DESTINATION`: (Defaults to `${CMAKE_INSTALL_BINDIR}`) Where to
77  place the binary.
78  * `LIBRARY_DESTINATION`: (Defaults to `${CMAKE_INSTALL_LIBDIR}`) Where
79  libraries are placed. Sets up `RPATH` on ELF platforms (e.g., Linux and the
80  BSD family).
81 #]==]
83  cmake_parse_arguments(_paraview_client
84  ""
85  "NAME;APPLICATION_NAME;ORGANIZATION;TITLE;SPLASH_IMAGE;BUNDLE_DESTINATION;BUNDLE_ICON;BUNDLE_PLIST;APPLICATION_ICON;MAIN_WINDOW_CLASS;MAIN_WINDOW_INCLUDE;VERSION;FORCE_UNIX_LAYOUT;PLUGINS_TARGET;DEFAULT_STYLE;RUNTIME_DESTINATION;LIBRARY_DESTINATION;NAMESPACE;EXPORT"
86  "REQUIRED_PLUGINS;OPTIONAL_PLUGINS;APPLICATION_XMLS;SOURCES;QCH_FILES;QCH_FILE;PLUGINS_TARGETS"
87  ${ARGN})
88 
89  if (_paraview_client_UNPARSED_ARGUMENTS)
90  message(FATAL_ERROR
91  "Unparsed arguments for paraview_client_add: "
92  "${_paraview_client_UNPARSED_ARGUMENTS}")
93  endif ()
94 
95  # TODO: Installation.
96 
97  if (DEFINED _paraview_client_PLUGINS_TARGET)
98  if (DEFINED _paraview_client_PLUGINS_TARGETS)
99  message(FATAL_ERROR
100  "The `paraview_client_add(PLUGINS_TARGET)` argument is incompatible "
101  "with `PLUGINS_TARGETS`.")
102  else ()
103  message(DEPRECATION
104  "The `paraview_client_add(PLUGINS_TARGET)` argument is deprecated in "
105  "favor of `PLUGINS_TARGETS`.")
106  set(_paraview_client_PLUGINS_TARGETS
107  "${_paraview_client_PLUGINS_TARGET}")
108  endif ()
109  endif ()
110 
111  if (NOT DEFINED _paraview_client_NAME)
112  message(FATAL_ERROR
113  "The `NAME` argument is required.")
114  endif ()
115 
116  if (NOT DEFINED _paraview_client_VERSION)
117  message(FATAL_ERROR
118  "The `VERSION` argument is required.")
119  endif ()
120 
121  if (NOT DEFINED _paraview_client_SOURCES)
122  message(FATAL_ERROR
123  "The `SOURCES` argument is required.")
124  endif ()
125 
126  if (NOT DEFINED _paraview_client_APPLICATION_NAME)
127  set(_paraview_client_APPLICATION_NAME
128  "${_paraview_client_NAME}")
129  endif ()
130 
131  if (NOT DEFINED _paraview_client_ORGANIZATION)
132  set(_paraview_client_ORGANIZATION
133  "Anonymous")
134  endif ()
135 
136  if (NOT DEFINED _paraview_client_FORCE_UNIX_LAYOUT)
137  set(_paraview_client_FORCE_UNIX_LAYOUT
138  OFF)
139  endif ()
140 
141  if (NOT DEFINED _paraview_client_BUNDLE_DESTINATION)
142  set(_paraview_client_BUNDLE_DESTINATION
143  "Applications")
144  endif ()
145 
146  if (NOT DEFINED _paraview_client_RUNTIME_DESTINATION)
147  set(_paraview_client_RUNTIME_DESTINATION
148  "${CMAKE_INSTALL_BINDIR}")
149  endif ()
150 
151  if (NOT DEFINED _paraview_client_LIBRARY_DESTINATION)
152  set(_paraview_client_LIBRARY_DESTINATION
153  "${CMAKE_INSTALL_LIBDIR}")
154  endif ()
155 
156  if (DEFINED _paraview_client_QCH_FILE)
157  if (DEFINED _paraview_client_QCH_FILES)
158  message(FATAL_ERROR
159  "The `paraview_client_add(QCH_FILE)` argument is incompatible "
160  "with `QCH_FILES`.")
161  else ()
162  message(DEPRECATION
163  "The `paraview_client_add(QCH_FILE)` argument is deprecated in "
164  "favor of `QCH_FILES`.")
165  set(_paraview_client_QCH_FILES
166  "${_paraview_client_QCH_FILE}")
167  endif ()
168  endif ()
169 
170  if (NOT DEFINED _paraview_client_MAIN_WINDOW_CLASS)
171  if (DEFINED _paraview_client_MAIN_WINDOW_INCLUDE)
172  message(FATAL_ERROR
173  "The `MAIN_WINDOW_INCLUDE` argument cannot be specified without "
174  "`MAIN_WINDOW_CLASS`.")
175  endif ()
176 
177  set(_paraview_client_MAIN_WINDOW_CLASS
178  "QMainWindow")
179  set(_paraview_client_MAIN_WINDOW_INCLUDE
180  "QMainWindow")
181  endif ()
182 
183  if (NOT DEFINED _paraview_client_MAIN_WINDOW_INCLUDE)
184  set(_paraview_client_MAIN_WINDOW_INCLUDE
185  "${_paraview_client_MAIN_WINDOW_CLASS}.h")
186  endif ()
187 
188  set(_paraview_client_extra_sources)
189  set(_paraview_client_bundle_args)
190 
191  set(_paraview_client_executable_flags)
192  if (WIN32)
193  if (DEFINED _paraview_client_APPLICATION_ICON)
194  set(_paraview_client_appicon_file
195  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_client_NAME}_appicon.rc")
196  file(WRITE "${_paraview_client_appicon_file}.tmp"
197  "// Icon with the lowest ID value placed first to ensure that the application
198 // icon remains consistent on all systems.
199 IDI_ICON1 ICON \"${_paraview_client_APPLICATION_ICON}\"\n")
200  configure_file(
201  "${_paraview_client_appicon_file}.tmp"
202  "${_paraview_client_appicon_file}"
203  COPYONLY)
204 
205  list(APPEND _paraview_client_extra_sources
206  "${_paraview_client_appicon_file}")
207  endif ()
208 
209  list(APPEND _paraview_client_executable_flags
210  WIN32)
211  elseif (APPLE)
212  # TODO: nib files
213 
214  list(APPEND _paraview_client_bundle_args
215  BUNDLE DESTINATION "${_paraview_client_BUNDLE_DESTINATION}")
216  list(APPEND _paraview_client_executable_flags
217  MACOSX_BUNDLE)
218  endif ()
219 
220  set(_paraview_client_resource_files "")
221  set(_paraview_client_resource_init "")
222 
223  if (DEFINED _paraview_client_SPLASH_IMAGE)
224  set(_paraview_client_splash_base_name
225  "${_paraview_client_NAME}_splash")
226  set(_paraview_client_splash_image_name
227  "${_paraview_client_splash_base_name}.img")
228  set(_paraview_client_splash_resource
229  ":/${_paraview_client_NAME}/${_paraview_client_splash_base_name}")
230 
231  set(_paraview_client_splash_resource_file
232  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_client_splash_base_name}.qrc")
233 
235  OUTPUT "${_paraview_client_splash_resource_file}"
236  PREFIX "/${_paraview_client_NAME}"
237  ALIAS "${_paraview_client_splash_base_name}"
238  FILE "${_paraview_client_SPLASH_IMAGE}")
239 
240  list(APPEND _paraview_client_resource_files
241  "${_paraview_client_splash_resource_file}")
242  string(APPEND _paraview_client_resource_init
243  " Q_INIT_RESOURCE(${_paraview_client_splash_base_name});\n")
244  set(CMAKE_AUTORCC 1)
245  endif ()
246 
247  if (DEFINED _paraview_client_APPLICATION_XMLS)
248  set(_paraview_client_application_base_name
249  "${_paraview_client_NAME}_configuration")
250  set(_paraview_client_application_resource_file
251  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_client_application_base_name}.qrc")
252 
254  OUTPUT "${_paraview_client_application_resource_file}"
255  PREFIX "/${_paraview_client_NAME}/Configuration"
256  FILES "${_paraview_client_APPLICATION_XMLS}")
257 
258  list(APPEND _paraview_client_resource_files
259  "${_paraview_client_application_resource_file}")
260  string(APPEND _paraview_client_resource_init
261  " Q_INIT_RESOURCE(${_paraview_client_application_base_name});\n")
262  set(CMAKE_AUTORCC 1)
263  endif ()
264 
265  if (DEFINED _paraview_client_QCH_FILES)
266  set(_paraview_client_documentation_base_name
267  "${_paraview_client_NAME}_documentation")
268  set(_paraview_client_documentation_resource_file
269  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_client_documentation_base_name}.qrc")
270 
272  OUTPUT "${_paraview_client_documentation_resource_file}"
273  # This prefix is part of the API.
274  PREFIX "/${_paraview_client_NAME}/Documentation"
275  FILES ${_paraview_client_QCH_FILES})
276  set_property(SOURCE "${_paraview_client_documentation_resource_file}"
277  PROPERTY
278  OBJECT_DEPENDS "${_paraview_client_QCH_FILES}")
279 
280  list(APPEND _paraview_client_resource_files
281  "${_paraview_client_documentation_resource_file}")
282  string(APPEND _paraview_client_resource_init
283  " Q_INIT_RESOURCE(${_paraview_client_documentation_base_name});\n")
284  set(CMAKE_AUTORCC 1)
285  endif ()
286 
287  include("${_ParaViewClient_cmake_dir}/paraview-find-package-helpers.cmake" OPTIONAL)
288  find_package(Qt5 REQUIRED QUIET COMPONENTS Core Widgets)
289 
290  # CMake 3.13 started using Qt5's version variables to detect what version
291  # of Qt's tools to run for autorcc. However, they are looked up using the
292  # target's directory scope, but these are here in a local scope and unset
293  # when AutoGen gets around to asking about the variables at generate time.
294 
295  # Fix for 3.13.0–3.13.3. Does not work if `paraview_client_add` is called
296  # from another function.
297  set(Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}" PARENT_SCOPE)
298  set(Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MINOR}" PARENT_SCOPE)
299  # Fix for 3.13.4+.
300  set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
301  PROPERTY
302  Qt5Core_VERSION_MAJOR "${Qt5Core_VERSION_MAJOR}")
303  set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
304  PROPERTY
305  Qt5Core_VERSION_MINOR "${Qt5Core_VERSION_MAJOR}")
306 
307  set(_paraview_client_built_shared 0)
308  if (BUILD_SHARED_LIBS)
309  set(_paraview_client_built_shared 1)
310  endif ()
311 
312  set(_paraview_client_have_plugins 0)
313  set(_paraview_client_plugins_includes)
314  set(_paraview_client_plugins_calls)
315  if (_paraview_client_PLUGINS_TARGETS)
316  set(_paraview_client_have_plugins 1)
317  foreach (_paraview_client_plugin_target IN LISTS _paraview_client_PLUGINS_TARGETS)
318  string(REPLACE "::" "_" _paraview_client_plugin_target_safe "${_paraview_client_plugin_target}")
319  string(APPEND _paraview_client_plugins_includes
320  "#include \"${_paraview_client_plugin_target_safe}.h\"\n")
321  string(APPEND _paraview_client_plugins_calls
322  " ${_paraview_client_plugin_target_safe}_initialize();\n")
323  endforeach ()
324  endif ()
325 
326  set(_paraview_client_source_files
327  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_client_NAME}_main.cxx"
328  "${CMAKE_CURRENT_BINARY_DIR}/pq${_paraview_client_NAME}Initializer.cxx"
329  "${CMAKE_CURRENT_BINARY_DIR}/pq${_paraview_client_NAME}Initializer.h")
330  configure_file(
331  "${_ParaViewClient_cmake_dir}/paraview_client_main.cxx.in"
332  "${CMAKE_CURRENT_BINARY_DIR}/${_paraview_client_NAME}_main.cxx"
333  @ONLY)
334  configure_file(
335  "${_ParaViewClient_cmake_dir}/paraview_client_initializer.cxx.in"
336  "${CMAKE_CURRENT_BINARY_DIR}/pq${_paraview_client_NAME}Initializer.cxx"
337  @ONLY)
338  configure_file(
339  "${_ParaViewClient_cmake_dir}/paraview_client_initializer.h.in"
340  "${CMAKE_CURRENT_BINARY_DIR}/pq${_paraview_client_NAME}Initializer.h"
341  @ONLY)
342 
343  # Set up rpaths
344  set(CMAKE_BUILD_RPATH_USE_ORIGIN 1)
345  if (UNIX AND NOT APPLE)
346  file(RELATIVE_PATH _paraview_client_relpath
347  "/prefix/${_paraview_client_RUNTIME_DESTINATION}"
348  "/prefix/${_paraview_client_LIBRARY_DESTINATION}")
349  set(_paraview_client_origin_rpath
350  "$ORIGIN/${_paraview_client_relpath}")
351 
352  list(APPEND CMAKE_INSTALL_RPATH
353  "${_paraview_client_origin_rpath}")
354  endif ()
355 
356  if (_paraview_client_resource_files)
357  source_group("resources"
358  FILES
359  ${_paraview_client_resource_files})
360  endif ()
361  add_executable("${_paraview_client_NAME}" ${_paraview_client_executable_flags}
362  ${_paraview_client_SOURCES}
363  ${_paraview_client_resource_files}
364  ${_paraview_client_source_files}
365  ${_paraview_client_extra_sources})
366  if (DEFINED _paraview_client_NAMESPACE)
367  add_executable("${_paraview_client_NAMESPACE}::${_paraview_client_NAME}" ALIAS "${_paraview_client_NAME}")
368  endif ()
369  target_include_directories("${_paraview_client_NAME}"
370  PRIVATE
371  "${CMAKE_CURRENT_SOURCE_DIR}"
372  "${CMAKE_CURRENT_BINARY_DIR}"
373  # https://gitlab.kitware.com/cmake/cmake/-/issues/18049
374  "$<TARGET_PROPERTY:VTK::vtksys,INTERFACE_INCLUDE_DIRECTORIES>")
375  target_link_libraries("${_paraview_client_NAME}"
376  PRIVATE
377  ParaView::pqApplicationComponents
378  Qt5::Widgets
379  VTK::vtksys)
380 
381  set(_paraview_client_export)
382  if (DEFINED _paraview_client_EXPORT)
383  list(APPEND _paraview_client_export
384  EXPORT "${_paraview_client_EXPORT}")
385  endif ()
386 
387  install(
388  TARGETS "${_paraview_client_NAME}"
389  ${_paraview_client_export}
390  COMPONENT "runtime"
391  ${_paraview_client_bundle_args}
392  RUNTIME DESTINATION "${_paraview_client_RUNTIME_DESTINATION}")
393 
394  if (DEFINED _paraview_client_PLUGINS_TARGETS)
395  target_link_libraries("${_paraview_client_NAME}"
396  PRIVATE
397  ${_paraview_client_PLUGINS_TARGETS})
398 
399  set(_paraview_client_binary_destination
400  "${_paraview_client_RUNTIME_DESTINATION}")
401  set(_paraview_client_conf_destination
402  "${_paraview_client_binary_destination}")
403  if (APPLE)
404  string(APPEND _paraview_client_binary_destination
405  "/${_paraview_client_NAME}.app/Contents/Resources")
406  set(_paraview_client_conf_destination
407  "${_paraview_client_BUNDLE_DESTINATION}/${_paraview_client_NAME}.app/Contents/Resources")
408  endif ()
409 
411  NAME "${_paraview_client_NAME}"
412  PLUGINS_TARGETS ${_paraview_client_PLUGINS_TARGETS}
413  BUILD_DESTINATION "${_paraview_client_binary_destination}"
414  INSTALL_DESTINATION "${_paraview_client_conf_destination}"
415  COMPONENT "runtime")
416  endif ()
417 
418  if (APPLE)
419  if (DEFINED _paraview_client_BUNDLE_ICON)
420  get_filename_component(_paraview_client_bundle_icon_file "${_paraview_client_BUNDLE_ICON}" NAME)
421  set_property(TARGET "${_paraview_client_NAME}"
422  PROPERTY
423  MACOSX_BUNDLE_ICON_FILE "${_paraview_client_bundle_icon_file}")
424  install(
425  FILES "${_paraview_client_BUNDLE_ICON}"
426  DESTINATION "${_paraview_client_BUNDLE_DESTINATION}/${_paraview_client_APPLICATION_NAME}.app/Contents/Resources"
427  COMPONENT "runtime")
428  endif ()
429  if (DEFINED _paraview_client_BUNDLE_PLIST)
430  set_property(TARGET "${_paraview_client_NAME}"
431  PROPERTY
432  MACOSX_BUNDLE_INFO_PLIST "${_paraview_client_BUNDLE_PLIST}")
433  endif ()
434  string(TOLOWER "${_paraview_client_ORGANIZATION}" _paraview_client_organization)
435  set_target_properties("${_paraview_client_NAME}"
436  PROPERTIES
437  MACOSX_BUNDLE_BUNDLE_NAME "${_paraview_client_APPLICATION_NAME}"
438  MACOSX_BUNDLE_GUI_IDENTIFIER "org.${_paraview_client_organization}.${_paraview_client_APPLICATION_NAME}"
439  MACOSX_BUNDLE_SHORT_VERSION_STRING "${_paraview_client_VERSION}")
440  endif ()
441 endfunction ()
442 
443 #[==[.md INTERNAL
444 ## Quoting
445 
446 Passing CMake lists down to the help generation and proxy documentation steps
447 requires escaping the `;` in them. These functions escape and unescape the
448 variable passed in. The new value is placed in the same variable in the calling
449 scope.
450 #]==]
451 
453  string(REPLACE "_" "_u" _escape_tmp "${${variable}}")
454  string(REPLACE ";" "_s" _escape_tmp "${_escape_tmp}")
455  set("${variable}"
456  "${_escape_tmp}"
457  PARENT_SCOPE)
458 endfunction ()
459 
461  string(REPLACE "_s" ";" _escape_tmp "${${variable}}")
462  string(REPLACE "_u" "_" _escape_tmp "${_escape_tmp}")
463  set("${variable}"
464  "${_escape_tmp}"
465  PARENT_SCOPE)
466 endfunction ()
467 
468 #[==[.md
469 ## Documentation from XML files
470 
471 Documentation can be generated from server manager XML files. The
472 `paraview_client_documentation` generates Qt help, HTML, and Wiki documentation
473 from them.
474 
475 ```
477  TARGET <target>
478  XMLS <xml>...
479  [OUTPUT_DIR <directory>])
480 ```
481 
482  * `TARGET`: (Required) The name of the target to generate.
483  * `XMLS`: (Required) The list of XML files to process.
484  * `OUTPUT_DIR`: (Defaults to `${CMAKE_CURRENT_BINARY_DIR}`) Where to place
485  generated documentation.
486 #]==]
488  cmake_parse_arguments(_paraview_client_doc
489  ""
490  "TARGET;OUTPUT_DIR"
491  "XMLS"
492  ${ARGN})
493 
494  if (_paraview_client_doc_UNPARSED_ARGUMENTS)
495  message(FATAL_ERROR
496  "Unparsed arguments for paraview_client_documentation: "
497  "${_paraview_client_doc_UNPARSED_ARGUMENTS}")
498  endif ()
499 
500  if (NOT DEFINED _paraview_client_doc_OUTPUT_DIR)
501  set(_paraview_client_doc_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}")
502  endif ()
503 
504  if (NOT DEFINED _paraview_client_doc_TARGET)
505  message(FATAL_ERROR
506  "The `TARGET` argument is required.")
507  endif ()
508 
509  if (NOT DEFINED _paraview_client_doc_XMLS)
510  message(FATAL_ERROR
511  "The `XMLS` argument is required.")
512  endif ()
513 
514  include("${_ParaViewClient_cmake_dir}/paraview-find-package-helpers.cmake" OPTIONAL)
515  find_program(qt_xmlpatterns_executable
516  NAMES xmlpatterns-qt5 xmlpatterns
517  HINTS "${Qt5_DIR}/../../../bin"
518  "${Qt5_DIR}/../../../libexec/qt5/bin"
519  DOC "Path to xmlpatterns")
520  mark_as_advanced(qt_xmlpatterns_executable)
521 
522  if (NOT qt_xmlpatterns_executable)
523  message(FATAL_ERROR
524  "Cannot find the xmlpatterns executable.")
525  endif ()
526 
527  set(_paraview_client_doc_xmls)
528  foreach (_paraview_client_doc_xml IN LISTS _paraview_client_doc_XMLS)
529  get_filename_component(_paraview_client_doc_xml "${_paraview_client_doc_xml}" ABSOLUTE)
530  list(APPEND _paraview_client_doc_xmls
531  "${_paraview_client_doc_xml}")
532  endforeach ()
533 
534  # Save xmls to a temporary file.
535  set (_paraview_client_doc_xmls_file
536  "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_paraview_client_doc_TARGET}-xmls.txt")
537  file(GENERATE
538  OUTPUT "${_paraview_client_doc_xmls_file}"
539  CONTENT "${_paraview_client_doc_xmls}")
540 
541  add_custom_command(
542  OUTPUT "${_paraview_client_doc_OUTPUT_DIR}/${_paraview_client_doc_TARGET}.xslt"
543  ${_paraview_client_doc_outputs}
544  COMMAND "${CMAKE_COMMAND}"
545  "-Dxmlpatterns=${qt_xmlpatterns_executable}"
546  "-Doutput_dir=${_paraview_client_doc_OUTPUT_DIR}"
547  "-Doutput_file=${_paraview_client_doc_OUTPUT_DIR}/${_paraview_client_doc_TARGET}.xslt"
548  "-Dxmls_file=${_paraview_client_doc_xmls_file}"
549  -D_paraview_generate_proxy_documentation_run=ON
550  -P "${_ParaViewClient_script_file}"
551  DEPENDS ${_paraview_client_doc_xmls_list}
552  "${_paraview_client_doc_xmls_file}"
553  "${_ParaViewClient_script_file}"
554  "${_ParaViewClient_cmake_dir}/paraview_servermanager_convert_xml.xsl"
555  "${_ParaViewClient_cmake_dir}/paraview_servermanager_convert_categoryindex.xsl"
556  "${_ParaViewClient_cmake_dir}/paraview_servermanager_convert_html.xsl"
557  "${_ParaViewClient_cmake_dir}/paraview_servermanager_convert_wiki.xsl.in"
558  WORKING_DIRECTORY "${_paraview_client_doc_OUTPUT_DIR}"
559  COMMENT "Generating documentation for ${_paraview_client_doc_TARGET}")
560  add_custom_target("${_paraview_client_doc_TARGET}"
561  DEPENDS
562  "${_paraview_client_doc_OUTPUT_DIR}/${_paraview_client_doc_TARGET}.xslt"
563  ${_paraview_client_doc_outputs})
564 endfunction ()
565 
566 # Generate proxy documentation.
567 if (_paraview_generate_proxy_documentation_run AND CMAKE_SCRIPT_MODE_FILE)
568 
569  file(READ "${xmls_file}" xmls)
570 
571  set(_paraview_gpd_to_xml "${CMAKE_CURRENT_LIST_DIR}/paraview_servermanager_convert_xml.xsl")
572  set(_paraview_gpd_to_catindex "${CMAKE_CURRENT_LIST_DIR}/paraview_servermanager_convert_categoryindex.xsl")
573  set(_paraview_gpd_to_html "${CMAKE_CURRENT_LIST_DIR}/paraview_servermanager_convert_html.xsl")
574  set(_paraview_gpd_to_wiki "${CMAKE_CURRENT_LIST_DIR}/paraview_servermanager_convert_wiki.xsl.in")
575 
576  set(_paraview_gpd_xslt "<xml>\n")
577  file(MAKE_DIRECTORY "${output_dir}")
578  foreach (_paraview_gpd_xml IN LISTS xmls)
579  execute_process(
580  COMMAND "${xmlpatterns}"
581  "${_paraview_gpd_to_xml}"
582  "${_paraview_gpd_xml}"
583  OUTPUT_VARIABLE _paraview_gpd_output
584  ERROR_VARIABLE _paraview_gpd_error
585  RESULT_VARIABLE _paraview_gpd_result)
586  if (_paraview_gpd_result)
587  message(FATAL_ERROR
588  "Failed to convert servermanager XML: ${_paraview_gpd_error}")
589  endif ()
590 
591  string(APPEND _paraview_gpd_xslt
592  "${_paraview_gpd_output}")
593  endforeach ()
594  string(APPEND _paraview_gpd_xslt
595  "</xml>\n")
596 
597  file(WRITE "${output_file}.xslt"
598  "${_paraview_gpd_xslt}")
599  execute_process(
600  COMMAND "${xmlpatterns}"
601  -output "${output_file}"
602  "${_paraview_gpd_to_catindex}"
603  "${output_file}.xslt"
604  RESULT_VARIABLE _paraview_gpd_result)
605  if (_paraview_gpd_result)
606  message(FATAL_ERROR
607  "Failed to generate category index")
608  endif ()
609 
610  # Generate HTML files.
611  execute_process(
612  COMMAND "${xmlpatterns}"
613  "${_paraview_gpd_to_html}"
614  "${output_file}"
615  OUTPUT_VARIABLE _paraview_gpd_output
616  RESULT_VARIABLE _paraview_gpd_result
617  OUTPUT_STRIP_TRAILING_WHITESPACE)
618  if (_paraview_gpd_result)
619  message(FATAL_ERROR
620  "Failed to generate HTML output")
621  endif ()
622 
623  # Escape semicolons.
624  _paraview_client_escape_cmake_list(_paraview_gpd_output)
625  # Convert into a list of HTML documents.
626  string(REPLACE "</html>\n<html>" "</html>\n;<html>" _paraview_gpd_output "${_paraview_gpd_output}")
627 
628  foreach (_paraview_gpd_html_doc IN LISTS _paraview_gpd_output)
629  string(REGEX MATCH "<meta name=\"filename\" contents=\"([^\"]*)\"" _ "${_paraview_gpd_html_doc}")
630  set(_paraview_gpd_filename "${CMAKE_MATCH_1}")
631  if (NOT _paraview_gpd_filename)
632  message(FATAL_ERROR
633  "No filename for an HTML output?")
634  endif ()
635 
636  _paraview_client_unescape_cmake_list(_paraview_gpd_html_doc)
637 
638  # Replace reStructured Text markup.
639  string(REGEX REPLACE "\\*\\*([^*]+)\\*\\*" "<b>\\1</b>" _paraview_gpd_html_doc "${_paraview_gpd_html_doc}")
640  string(REGEX REPLACE "\\*([^*]+)\\*" "<em>\\1</em>" _paraview_gpd_html_doc "${_paraview_gpd_html_doc}")
641  string(REGEX REPLACE "\n\n- " "\n<ul><li>" _paraview_gpd_html_doc "${_paraview_gpd_html_doc}")
642  string(REGEX REPLACE "\n-" "\n<li>" _paraview_gpd_html_doc "${_paraview_gpd_html_doc}")
643  string(REGEX REPLACE "<li>(.*)\n\n([^-])" "<li>\\1</ul>\n\\2" _paraview_gpd_html_doc "${_paraview_gpd_html_doc}")
644  string(REGEX REPLACE "\n\n" "\n<p>\n" _paraview_gpd_html_doc "${_paraview_gpd_html_doc}")
645  file(WRITE "${output_dir}/${_paraview_gpd_filename}"
646  "${_paraview_gpd_html_doc}\n")
647  endforeach ()
648 
649  # Generate Wiki files.
650  string(REGEX MATCHALL "proxy_group=\"[^\"]*\"" _paraview_gpd_groups "${_paraview_gpd_xslt}")
651  string(REGEX REPLACE "proxy_group=\"([^\"]*)\"" "\\1" _paraview_gpd_groups "${_paraview_gpd_groups}")
652  list(APPEND _paraview_gpd_groups readers)
653  if (_paraview_gpd_groups)
654  list(REMOVE_DUPLICATES _paraview_gpd_groups)
655  endif ()
656 
657  foreach (_paraview_gpd_group IN LISTS _paraview_gpd_groups)
658  if (_paraview_gpd_group STREQUAL "readers")
659  set(_paraview_gpd_query "contains(lower-case($proxy_name),'reader')")
660  set(_paraview_gpd_group_real "sources")
661  else ()
662  set(_paraview_gpd_query "not(contains(lower-case($proxy_name),'reader'))")
663  set(_paraview_gpd_group_real "${_paraview_gpd_group}")
664  endif ()
665 
666  set(_paraview_gpd_wiki_xsl
667  "${output_dir}/${_paraview_gpd_group}.xsl")
668  configure_file(
669  "${_paraview_gpd_to_wiki}"
670  "${_paraview_gpd_wiki_xsl}"
671  @ONLY)
672  execute_process(
673  COMMAND "${xmlpatterns}"
674  "${_paraview_gpd_wiki_xsl}"
675  "${output_file}"
676  OUTPUT_VARIABLE _paraview_gpd_output
677  RESULT_VARIABLE _paraview_gpd_result)
678  if (_paraview_gpd_result)
679  message(FATAL_ERROR
680  "Failed to generate Wiki output for ${_paraview_gpd_group}")
681  endif ()
682  string(REGEX REPLACE " +" " " _paraview_gpd_output "${_paraview_gpd_output}")
683  string(REPLACE "\n " "\n" _paraview_gpd_output "${_paraview_gpd_output}")
684  file(WRITE "${output_dir}/${_paraview_gpd_group}.wiki"
685  "${_paraview_gpd_output}")
686  endforeach ()
687 endif ()
688 
689 #[==[.md
690 ## Generating help documentation
691 
692 TODO: Document
693 
694 ```
696  NAME <name>
697  [TARGET <target>]
698 
699  OUTPUT_PATH <var>
700 
701  [OUTPUT_DIR <directory>]
702  [SOURCE_DIR <directory>]
703  [PATTERNS <pattern>...]
704  [DEPENDS <depend>...]
705 
706  [NAMESPACE <namespace>]
707  [FOLDER <folder>]
708 
709  [TABLE_OF_CONTENTS <toc>]
710  [TABLE_OF_CONTENTS_FILE <tocfile>]
711 
712  [RESOURCE_FILE <qrcfile>]
713  [RESOURCE_PREFIX <prefix>]
714 ```
715 
716  * `NAME`: (Required) The basename of the generated `.qch` file.
717  * `TARGET`: (Defaults to `<NAME>`) The name of the generated target.
718  * `OUTPUT_PATH`: (Required) This variable is set to the output path of the
719  generated `.qch` file.
720  * `OUTPUT_DIR`: (Defaults to `${CMAKE_CURRENT_BINARY_DIR}`) Where to place
721  generated files.
722  * `SOURCE_DIR`: Where to copy input files from.
723  * `PATTERNS`: (Defaults to `*.*`) If `SOURCE_DIR` is specified, files
724  matching these globs will be copied to `OUTPUT_DIR`.
725  * `DEPENDS`: A list of dependencies which are required before the help can be
726  generated. Note that file paths which are generated via
727  `add_custom_command` must be in the same directory as the
728  `paraview_client_generate_help` on non-Ninja generators.
729  * `NAMESPACE`: (Defaults to `<NAME>.org`) The namespace for the generated
730  help.
731  * `FOLDER`: (Defaults to `<NAME>`) The folder for the generated help.
732  * `TABLE_OF_CONTENTS` and `TABLE_OF_CONTENTS_FILE`: At most one may be
733  provided. This is used as the `<toc>` element in the generated help. If not
734  provided at all, a table of contents will be generated.
735  * `RESOURCE_FILE`: If provided, a Qt resource file providing the contents of
736  the generated help will be generated at this path. It will be available as
737  `<RESOURCE_PREFIX>/<NAME>`.
738  * `RESOURCE_PREFIX`: The prefix to use for the generated help's Qt resource.
739 #]==]
740 function (paraview_client_generate_help)
741  cmake_parse_arguments(_paraview_client_help
742  ""
743  "NAME;TARGET;OUTPUT_DIR;SOURCE_DIR;NAMESPACE;FOLDER;TABLE_OF_CONTENTS;TABLE_OF_CONTENTS_FILE;RESOURCE_FILE;RESOURCE_PREFIX;OUTPUT_PATH"
744  "PATTERNS;DEPENDS"
745  ${ARGN})
746 
747  if (_paraview_client_help_UNPARSED_ARGUMENTS)
748  message(FATAL_ERROR
749  "Unparsed arguments for paraview_client_generate_help: "
750  "${_paraview_client_help_UNPARSED_ARGUMENTS}")
751  endif ()
752 
753  if (NOT DEFINED _paraview_client_help_NAME)
754  message(FATAL_ERROR
755  "The `NAME` argument is required.")
756  endif ()
757 
758  if (NOT DEFINED _paraview_client_help_OUTPUT_PATH)
759  message(FATAL_ERROR
760  "The `OUTPUT_PATH` argument is required.")
761  endif ()
762 
763  if (NOT DEFINED _paraview_client_help_TARGET)
764  set(_paraview_client_help_TARGET
765  "${_paraview_client_help_NAME}")
766  endif ()
767 
768  if (NOT DEFINED _paraview_client_help_OUTPUT_DIR)
769  set(_paraview_client_help_OUTPUT_DIR
770  "${CMAKE_CURRENT_BINARY_DIR}/paraview_help")
771  endif ()
772 
773  if (NOT DEFINED _paraview_client_help_NAMESPACE)
774  set(_paraview_client_help_NAMESPACE
775  "${_paraview_client_help_NAME}.org")
776  endif ()
777 
778  if (NOT DEFINED _paraview_client_help_FOLDER)
779  set(_paraview_client_help_FOLDER
780  "${_paraview_client_help_NAME}")
781  endif ()
782 
783  if (DEFINED _paraview_client_help_TABLE_OF_CONTENTS_FILE)
784  file(READ "${_paraview_client_help_TABLE_OF_CONTENTS_FILE}"
785  _paraview_client_help_toc)
786  elseif (DEFINED _paraview_client_help_TABLE_OF_CONTENTS)
787  set(_paraview_client_help_toc
788  "${_paraview_client_help_TABLE_OF_CONTENTS}")
789  else ()
790  set(_paraview_client_help_toc)
791  endif ()
792  string(REPLACE "\n" " " _paraview_client_help_toc "${_paraview_client_help_toc}")
793 
794  if (NOT DEFINED _paraview_client_help_PATTERNS)
795  set(_paraview_client_help_PATTERNS
796  "*.*")
797  endif ()
798 
799  include("${_ParaViewClient_cmake_dir}/paraview-find-package-helpers.cmake" OPTIONAL)
800  find_package(Qt5 QUIET REQUIRED COMPONENTS Help)
801 
802  set(_paraview_client_help_copy_sources)
803  set(_paraview_client_help_copied_sources)
804  if (DEFINED _paraview_client_help_SOURCE_DIR)
805  list(APPEND _paraview_client_help_copy_sources
806  COMMAND "${CMAKE_COMMAND}" -E copy_directory
807  "${_paraview_client_help_SOURCE_DIR}"
808  "${_paraview_client_help_OUTPUT_DIR}")
809 
810  file(GLOB _paraview_client_help_copied_sources
811  ${_paraview_client_help_PATTERNS})
812  endif ()
813 
814  file(MAKE_DIRECTORY "${_paraview_client_help_OUTPUT_DIR}")
815 
816  set(_paraview_client_help_patterns "${_paraview_client_help_PATTERNS}")
817  _paraview_client_escape_cmake_list(_paraview_client_help_patterns)
818 
819  set(_paraview_client_help_qhp
820  "${_paraview_client_help_OUTPUT_DIR}/${_paraview_client_help_NAME}.qhp")
821  set(_paraview_client_help_output
822  "${_paraview_client_help_OUTPUT_DIR}/${_paraview_client_help_NAME}.qch")
823  add_custom_command(
824  OUTPUT "${_paraview_client_help_output}"
825  DEPENDS "${_ParaViewClient_script_file}"
826  ${_paraview_client_help_copied_sources}
827  ${_paraview_client_help_DEPENDS}
828  ${_paraview_client_help_copy_sources}
829  COMMAND "${CMAKE_COMMAND}"
830  "-Doutput_dir=${_paraview_client_help_OUTPUT_DIR}"
831  "-Doutput_file=${_paraview_client_help_qhp}"
832  "-Dnamespace=${_paraview_client_help_NAMESPACE}"
833  "-Dfolder=${_paraview_client_help_FOLDER}"
834  "-Dname=${_paraview_client_help_NAME}"
835  "-Dtoc=${_paraview_client_help_toc}"
836  "-Dpatterns=${_paraview_client_help_patterns}"
837  -D_paraview_generate_help_run=ON
838  -P "${_ParaViewClient_script_file}"
839  VERBATIM
840  COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}
841  $<TARGET_FILE:Qt5::qhelpgenerator>
842  "${_paraview_client_help_qhp}"
843  -s
844  -o "${_paraview_client_help_output}"
845  COMMENT "Compiling Qt help for ${_paraview_client_help_NAME}"
846  WORKING_DIRECTORY "${_paraview_client_help_OUTPUT_DIR}")
847  add_custom_target("${_paraview_client_help_TARGET}"
848  DEPENDS
849  "${_paraview_client_help_output}")
850 
851  if (DEFINED _paraview_client_help_RESOURCE_FILE)
852  if (NOT DEFINED _paraview_client_help_RESOURCE_PREFIX)
853  message(FATAL_ERROR
854  "The `RESOURCE_PREFIX` argument is required if `RESOURCE_FILE` is given.")
855  endif ()
856 
857  paraview_client_qt_resource(
858  OUTPUT "${_paraview_client_help_RESOURCE_FILE}"
859  PREFIX "${_paraview_client_help_RESOURCE_PREFIX}"
860  FILE "${_paraview_client_help_output}")
861  set_property(SOURCE "${_paraview_client_help_RESOURCE_FILE}"
862  PROPERTY
863  OBJECT_DEPENDS "${_paraview_client_help_output}")
864  endif ()
865 
866  set("${_paraview_client_help_OUTPUT_PATH}"
867  "${_paraview_client_help_output}"
868  PARENT_SCOPE)
869 endfunction ()
870 
871 # Handle the generation of the help file.
872 if (_paraview_generate_help_run AND CMAKE_SCRIPT_MODE_FILE)
873  _paraview_client_unescape_cmake_list(patterns)
874 
875  set(_paraview_help_patterns)
876  foreach (_paraview_help_pattern IN LISTS patterns)
877  if (IS_ABSOLUTE "${_paraview_help_pattern}")
878  list(APPEND _paraview_help_patterns
879  "${_paraview_help_pattern}")
880  else ()
881  list(APPEND _paraview_help_patterns
882  "${output_dir}/${_paraview_help_pattern}")
883  endif ()
884  endforeach ()
885 
886  file(GLOB _paraview_help_files
887  RELATIVE "${output_dir}"
888  ${_paraview_help_patterns})
889 
890  if (NOT toc)
891  if (NOT _paraview_help_files)
892  message(FATAL_ERROR
893  "No matching files given without a table of contents")
894  endif ()
895  set(_paraview_help_subsections "")
896  list(GET _paraview_help_files 0
897  _paraview_help_index)
898  set(_paraview_help_subsections "")
899  foreach (_paraview_help_file IN LISTS _paraview_help_files)
900  if (NOT _paraview_help_file MATCHES "\\.html$")
901  continue ()
902  endif ()
903  get_filename_component(_paraview_help_name "${_paraview_help_file}" NAME_WE)
904  set(_paraview_help_title "${_paraview_help_name}")
905  file(READ "${_paraview_help_file}" _paraview_help_contents)
906  string(REGEX MATCH "<title>([^<]*)</title>" _ "${_paraview_help_contents}")
907  if (CMAKE_MATCH_1)
908  set(_paraview_help_title "${CMAKE_MATCH_1}")
909  endif ()
910  string(APPEND _paraview_help_subsections
911  " <section title=\"${_paraview_help_title}\" ref=\"${_paraview_help_file}\" />\n")
912 
913  string(TOLOWER "${_paraview_help_name}" _paraview_help_name_lower)
914  if (_paraview_help_name_lower STREQUAL "index")
915  set(_paraview_help_index
916  "${_paraview_help_file}")
917  endif ()
918  endforeach ()
919  set(toc
920  "<toc>\n <section title=\"${name}\" ref=\"${_paraview_help_index}\">\n${_paraview_help_subsections} </section>\n</toc>")
921  endif ()
922 
923  set(_paraview_help_file_entries "")
924  foreach (_paraview_help_file IN LISTS _paraview_help_files)
925  string(APPEND _paraview_help_file_entries
926  " <file>${_paraview_help_file}</file>\n")
927  endforeach ()
928 
929  file(WRITE "${output_file}"
930  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
931 <QtHelpProject version=\"1.0\">
932  <namespace>${namespace}</namespace>
933  <virtualFolder>${folder}</virtualFolder>
934  <filterSection>
935  ${toc}
936  <keywords>
937  <!-- TODO: how to handle keywords? -->
938  </keywords>
939  <files>
940 ${_paraview_help_file_entries}
941  </files>
942  </filterSection>
943 </QtHelpProject>\n")
944 endif ()
945 
946 #[==[.md
947 ## Qt resources
948 
949 Compiling Qt resources into a client can be a little tedious. To help with
950 this, some functions are provided to make it easier to embed content into the
951 client.
952 #]==]
953 
954 #[==[.md
955 ### Single file
956 
957 ```
958 paraview_client_qt_resource(
959  OUTPUT <file>
960  PREFIX <prefix>
961  FILE <file>
962  [ALIAS <alias>])
963 ```
964 
965 Outputs a Qt resource to the file given to the `OUTPUT` argument. Its resource
966 name is `<PREFIX>/<ALIAS>`. The contents are copied from the contents of the
967 file specified by the `FILE` argument. If not given the name of the file is
968 used as the `ALIAS`.
969 #]==]
970 function (paraview_client_qt_resource)
971  cmake_parse_arguments(_paraview_client_resource
972  ""
973  "OUTPUT;PREFIX;ALIAS;FILE"
974  ""
975  ${ARGN})
976 
977  if (_paraview_client_resource_UNPARSED_ARGUMENTS)
978  message(FATAL_ERROR
979  "Unparsed arguments for paraview_client_qt_resource: "
980  "${_paraview_client_resource_UNPARSED_ARGUMENTS}")
981  endif ()
982 
983  if (NOT DEFINED _paraview_client_resource_OUTPUT)
984  message(FATAL_ERROR
985  "The `OUTPUT` argument is required.")
986  endif ()
987 
988  if (NOT DEFINED _paraview_client_resource_PREFIX)
989  message(FATAL_ERROR
990  "The `PREFIX` argument is required.")
991  endif ()
992 
993  if (NOT DEFINED _paraview_client_resource_FILE)
994  message(FATAL_ERROR
995  "The `FILE` argument is required.")
996  endif ()
997 
998  if (NOT DEFINED _paraview_client_resource_ALIAS)
999  get_filename_component(_paraview_client_resource_ALIAS
1000  "${_paraview_client_resource_FILE}"
1001  NAME)
1002  endif ()
1003 
1004  get_filename_component(_paraview_client_resource_file_path
1005  "${_paraview_client_resource_FILE}"
1006  ABSOLUTE)
1007  get_filename_component(_paraview_client_resource_file_path
1008  "${_paraview_client_resource_file_path}"
1009  REALPATH)
1010  if (WIN32)
1011  file(TO_NATIVE_PATH
1012  "${_paraview_client_resource_file_path}"
1013  _paraview_client_resource_file_path)
1014  endif ()
1015 
1016  # We cannot use file(GENERATE) because automoc doesn't like when generated
1017  # sources are in the source list.
1018  file(WRITE "${_paraview_client_resource_OUTPUT}.tmp"
1019  "<RCC>
1020  <qresource prefix=\"/${_paraview_client_resource_PREFIX}\">
1021  <file alias=\"${_paraview_client_resource_ALIAS}\">${_paraview_client_resource_file_path}</file>
1022  </qresource>
1023 </RCC>\n")
1024  configure_file(
1025  "${_paraview_client_resource_OUTPUT}.tmp"
1026  "${_paraview_client_resource_OUTPUT}"
1027  COPYONLY)
1028 endfunction ()
1029 
1030 #[==[.md
1031 ### Many files
1032 
1033 ```
1035  OUTPUT <file>
1036  PREFIX <prefix>
1037  FILES <file>...)
1038 ```
1039 
1040 Outputs a Qt resource to the file given to the `OUTPUT` argument. Its resource
1041 name is `<PREFIX>/<filename>` for each of the files in the given list. If
1042 aliases other than the filenames are required, the
1043 `paraview_client_qt_resource` function should be used instead.
1044 #]==]
1046  cmake_parse_arguments(_paraview_client_resources
1047  ""
1048  "OUTPUT;PREFIX"
1049  "FILES"
1050  ${ARGN})
1051 
1052  if (_paraview_client_resources_UNPARSED_ARGUMENTS)
1053  message(FATAL_ERROR
1054  "Unparsed arguments for paraview_client_qt_resources: "
1055  "${_paraview_client_resources_UNPARSED_ARGUMENTS}")
1056  endif ()
1057 
1058  if (NOT DEFINED _paraview_client_resources_OUTPUT)
1059  message(FATAL_ERROR
1060  "The `OUTPUT` argument is required.")
1061  endif ()
1062 
1063  if (NOT DEFINED _paraview_client_resources_PREFIX)
1064  message(FATAL_ERROR
1065  "The `PREFIX` argument is required.")
1066  endif ()
1067 
1068  if (NOT DEFINED _paraview_client_resources_FILES)
1069  message(FATAL_ERROR
1070  "The `FILES` argument is required.")
1071  endif ()
1072 
1073  set(_paraview_client_resources_contents)
1074 
1075  string(APPEND _paraview_client_resources_contents
1076  "<RCC>\n <qresource prefix=\"${_paraview_client_resources_PREFIX}\">\n")
1077  foreach (_paraview_client_resources_file IN LISTS _paraview_client_resources_FILES)
1078  get_filename_component(_paraview_client_resources_alias
1079  "${_paraview_client_resources_file}"
1080  NAME)
1081  get_filename_component(_paraview_client_resources_file_path
1082  "${_paraview_client_resources_file}"
1083  ABSOLUTE)
1084  get_filename_component(_paraview_client_resources_file_path
1085  "${_paraview_client_resources_file_path}"
1086  REALPATH)
1087  if (WIN32)
1088  file(TO_NATIVE_PATH
1089  "${_paraview_client_resources_file_path}"
1090  _paraview_client_resources_file_path)
1091  endif ()
1092  string(APPEND _paraview_client_resources_contents
1093  " <file alias=\"${_paraview_client_resources_alias}\">${_paraview_client_resources_file_path}</file>\n")
1094  endforeach ()
1095  string(APPEND _paraview_client_resources_contents
1096  " </qresource>\n</RCC>\n")
1097 
1098  # We cannot use file(GENERATE) because automoc doesn't like when generated
1099  # sources are in the source list.
1100  file(WRITE "${_paraview_client_resources_OUTPUT}.tmp"
1101  "${_paraview_client_resources_contents}")
1102  configure_file(
1103  "${_paraview_client_resources_OUTPUT}.tmp"
1104  "${_paraview_client_resources_OUTPUT}"
1105  COPYONLY)
1106 endfunction ()
function paraview_client_qt_resource()
.md Qt resources
style
boost::graph_traits< vtkGraph *>::vertex_descriptor target(boost::graph_traits< vtkGraph *>::edge_descriptor e, vtkGraph *)
on
version
function paraview_client_documentation()
.md Documentation from XML files
EXPORT
string
function paraview_client_qt_resources()
.md Many files
function paraview_client_add()
.md Building a client
name
function
function paraview_plugin_write_conf()
.md Plugin configuration files
#define VERSION
Definition: jconfigint.h:17
#define BUILD_SHARED_LIBS
Definition: config.h:45
function paraview_client_generate_help()
.md Generating help documentation
documentation
value
function _paraview_client_escape_cmake_list(variable)
.md INTERNAL Quoting
function _paraview_client_unescape_cmake_list(variable)