2@defgroup module Module CMake APIs
3@defgroup module-
internal Module Internal CMake APIs
4@defgroup module-
impl Module Implementation CMake APIs
5@defgroup module-support Module Support CMake APIs
10@page module-api-overview Module API
12This module includes functions to find and build VTK modules. A module is a set
13of related functionality. These are then compiled together into libraries at
14the
"kit" level. Each module may be
enabled or disabled individually and its
15dependencies will be built as needed.
17All functions strictly check their arguments.
Any unrecognized or invalid
18values
for a
function cause errors to be raised.
23@page module-
internal-api Internal API
25The VTK module system provides some API functions
for use by other code which
26consumes VTK modules (primarily language wrappers). This file documents these
27APIs. They may start with `_vtk_module`, but they are intended
for use in cases
28of
language wrappers or dealing with trickier third party packages.
33@page module-
impl-api Implementation API
35These functions are purely
internal implementation
details. No guarantees are
36made
for them and they may change at any
time (including wrapping code calls).
37Note that these functions are usually very lax in their argument parsing.
42@brief Conditionally output debug statements
45controlled by the `_vtk_module_log` variable which contains a list of
"domains"
49_vtk_module_debug(<domain> <format>)
52If the `domain` is
enabled for debugging, the `format` argument is configured
53and printed. It should contain `@` variable expansions to replace rather than
54it being done outside. This helps to avoid the cost of generating large strings
55when debugging is disabled.
58 if (NOT _vtk_module_log STREQUAL
"ALL" AND
59 NOT domain IN_LIST _vtk_module_log)
63 string(CONFIGURE
"${format}" _vtk_module_debug_msg)
64 if (_vtk_module_debug_msg)
66 "VTK module debug ${domain}: ${_vtk_module_debug_msg}")
70# TODO: Support finding `vtk.module` and `vtk.kit` contents in the
71# `CMakeLists.txt` files for the module via a comment header.
75@brief Find `
vtk.kit` files in a set of directories
78vtk_module_find_kits(<output> [<directory>...])
81This scans the given directories recursively
for `
vtk.kit` files and put the
82paths into the output variable.
85 set(_vtk_find_kits_all)
86 foreach (_vtk_find_kits_directory IN LISTS ARGN)
87 file(GLOB_RECURSE _vtk_find_kits_kits
88 "${_vtk_find_kits_directory}/vtk.kit")
89 list(APPEND _vtk_find_kits_all
90 ${_vtk_find_kits_kits})
92 set(
"${output}" ${_vtk_find_kits_all} PARENT_SCOPE)
97@brief Find `
vtk.module` files in a set of directories
100vtk_module_find_modules(<output> [<directory>...])
103This scans the given directories recursively
for `
vtk.module` files and
put the
104paths into the output variable. Note that module files are assumed to live
next
105to the `CMakeLists.txt` file which will build the module.
108 set(_vtk_find_modules_all)
109 foreach (_vtk_find_modules_directory IN LISTS ARGN)
110 file(GLOB_RECURSE _vtk_find_modules_modules
111 "${_vtk_find_modules_directory}/vtk.module")
112 list(APPEND _vtk_find_modules_all
113 ${_vtk_find_modules_modules})
115 set(
"${output}" ${_vtk_find_modules_all} PARENT_SCOPE)
122Module names may include a namespace. This
function splits the
name into a
129The `<prefix>_NAMESPACE` and `<prefix>_TARGET_NAME` variables will be set in
133 string(FIND
"${name}" "::" namespace_pos)
134 if (namespace_pos EQUAL -1)
136 set(target_name
"${name}")
138 string(SUBSTRING
"${name}" 0
"${namespace_pos}" namespace)
139 math(EXPR name_pos
"${namespace_pos} + 2")
140 string(SUBSTRING
"${name}" "${name_pos}" -1 target_name)
143 set(
"${prefix}_NAMESPACE"
146 set(
"${prefix}_TARGET_NAME"
153@page module-overview Module overview
155@section module-parse-module
vtk.module file contents
157The `
vtk.module` file is parsed and used as arguments to a CMake function which
158stores information about the module
for use when building it. Note that no
159variable expansion is allowed and it is not CMake code, so no control flow is
160allowed. Comments are supported and any content after a `#` on a line is
161treated as a comment. Due to the breakdown of the content, quotes are not
162meaningful within the files.
172 The base VTK library.
184All values are optional unless otherwise noted. The following arguments are
187 * `NAME`: (Required) The name of the module.
188 * `LIBRARY_NAME`: The base name of the library file. It defaults to the
189 module name, but any namespaces are removed. For example, a `NS::Foo`
190 module will have a
default `LIBRARY_NAME` of `Foo`.
191 * `DESCRIPTION`: (Recommended) Short text describing what the module is
for.
192 * `KIT`: The name of the kit the module belongs to (see `Kits files`
for more
194 * `IMPLEMENTABLE`: If present, the module contains logic which supports the
195 autoinit functionality.
196 * `GROUPS`: Modules may belong to
"groups" which is exposed as a build
197 option. This allows
for enabling a set of modules with a single build
199 * `CONDITION`: Arguments to CMake
's `if` command which may be used to hide
200 the module for certain platforms or other reasons. If the expression is
201 false, the module is completely ignored.
202 * `DEPENDS`: A list of modules which are required by this module and modules
204 * `PRIVATE_DEPENDS`: A list of modules which are required by this module, but
205 not by those using this module.
206 * `OPTIONAL_DEPENDS`: A list of modules which are used by this module if
207 enabled; these are treated as `PRIVATE_DEPENDS` if they exist.
208 * `ORDER_DEPENDS`: Dependencies which only matter for ordering. This does not
209 mean that the module will be enabled, just guaranteed to build before this
211 * `IMPLEMENTS`: A list of modules for which this module needs to register
213 * `TEST_DEPENDS`: Modules required by the test suite for this module.
214 * `TEST_OPTIONAL_DEPENDS`: Modules used by the test suite for this module if
216 * `TEST_LABELS`: Labels to apply to the tests of this module. By default, the
217 module name is applied as a label.
218 * `EXCLUDE_WRAP`: If present, this module should not be wrapped in any
220 * `THIRD_PARTY`: If present, this module is a third party module.
221 * `LICENSE_FILES`: A list of license files to install for the module. Optional.
226@brief Parse `vtk.module` file contents
228This macro places all `vtk.module` keyword "arguments" into the caller's scope
229prefixed with the value of `name_output` which is set to the `NAME` of the
233_vtk_module_parse_module_args(name_output <vtk.module args...>)
236For example,
this `
vtk.module` file:
246variables in the calling scope:
248 - `name`: `Namespace::Target`
249 - `Namespace::Target_LIBRARY_NAME`: `nsTarget`
251With
namespace support for module names, the variable should instead be
252referenced via `${${name}_LIBRARY_NAME}` instead.
255 cmake_parse_arguments(
"_name"
263 "A VTK module requires a name (from ${_vtk_scan_module_file}).")
265 set(
"${name_output}" "${_name_NAME}")
267 cmake_parse_arguments(
"${_name_NAME}"
268 "IMPLEMENTABLE;EXCLUDE_WRAP;THIRD_PARTY"
269 "LIBRARY_NAME;NAME;KIT"
270 "GROUPS;DEPENDS;PRIVATE_DEPENDS;OPTIONAL_DEPENDS;ORDER_DEPENDS;TEST_DEPENDS;TEST_OPTIONAL_DEPENDS;TEST_LABELS;DESCRIPTION;CONDITION;IMPLEMENTS;LICENSE_FILES"
273 if (${_name_NAME}_UNPARSED_ARGUMENTS)
275 "Unparsed arguments for ${_name_NAME}: "
276 "${${_name_NAME}_UNPARSED_ARGUMENTS}")
279 if (NOT ${_name_NAME}_DESCRIPTION AND _vtk_module_warnings)
280 message(WARNING
"The ${_name_NAME} module should have a description")
282 string(REPLACE
";" " " "${_name_NAME}_DESCRIPTION" "${${_name_NAME}_DESCRIPTION}")
286 if (NOT DEFINED
"${_name_NAME}_LIBRARY_NAME")
287 set(
"${_name_NAME}_LIBRARY_NAME" "${${_name_NAME}_TARGET_NAME}")
290 if (NOT ${_name_NAME}_LIBRARY_NAME)
291 message(FATAL_ERROR
"The ${_name_NAME} module must have a non-empty `LIBRARY_NAME`.")
294 list(APPEND
"${_name_NAME}_TEST_LABELS"
295 "${${_name_NAME}_NAME}"
296 "${${_name_NAME}_LIBRARY_NAME}")
302@section module-parse-kit
vtk.kit file contents
304The `
vtk.kit` file is parsed similarly to `
vtk.module` files. Kits are intended
305to bring together related modules into a single library in
order to reduce the
306number of objects that linkers need to deal with.
316 Core utilities
for VTK.
319All values are optional unless otherwise noted. The following arguments are
322 * `NAME`: (Required) The
name of the kit.
323 * `LIBRARY_NAME`: The base
name of the library file. It defaults to the
324 module
name, but any namespaces are removed. For example, a `NS::Foo`
325 module will have a
default `LIBRARY_NAME` of `Foo`.
326 * `DESCRIPTION`: (Recommended) Short text describing what the kit contains.
331@brief Parse `
vtk.kit` file contents
336 cmake_parse_arguments(
"_name"
344 "A VTK kit requires a name (from ${_vtk_scan_kit_file}).")
346 set(
"${name_output}" "${_name_NAME}")
348 cmake_parse_arguments(
"${_name_NAME}"
354 if (${_name_NAME}_UNPARSED_ARGUMENTS)
356 "Unparsed arguments for ${_name_NAME}: "
357 "${${_name_NAME}_UNPARSED_ARGUMENTS}")
362 if (NOT DEFINED
"${_name_NAME}_LIBRARY_NAME")
363 set(
"${_name_NAME}_LIBRARY_NAME" "${${_name_NAME}_TARGET_NAME}")
366 if (NOT ${_name_NAME}_LIBRARY_NAME)
367 message(FATAL_ERROR
"The ${_name_NAME} module must have a non-empty `LIBRARY_NAME`.")
370 if (NOT ${_name_NAME}_DESCRIPTION AND _vtk_module_warnings)
371 message(WARNING
"The ${_name_NAME} kit should have a description")
373 string(REPLACE
";" " " "${_name_NAME}_DESCRIPTION" "${${_name_NAME}_DESCRIPTION}")
380@section module-enable-status Enable status values
382Modules and groups are enable and disable preferences are specified
using a
385 - `YES`: The module or group must be built.
386 - `NO`: The module or group must not be built.
387 - `WANT`: The module or group should be built
if possible.
388 - `DONT_WANT`: The module or group should only be built
if required (e.g.,
390 - `DEFAULT`: Acts as either `WANT` or `DONT_WANT` based
on the group settings
391 for the module or `WANT_BY_DEFAULT` option to @ref
vtk_module_scan if no
392 other preference is specified. This is usually handled via another setting
395If a `YES` module preference
requires a module with a `NO` preference, an error
398A
module with a setting of `DEFAULT` will look for its first non-`DEFAULT`
399group setting and only if all of those are set to `DEFAULT` is the
400`WANT_BY_DEFAULT` setting used.
405@brief Verify enable values
407Verifies that the variable named as the first parameter is a valid `enable
411_vtk_module_verify_enable_value(var)
414function (_vtk_module_verify_enable_value var)
415 if (NOT (${var} STREQUAL "YES" OR
416 ${var} STREQUAL "WANT" OR
417 ${var} STREQUAL "DONT_WANT" OR
418 ${var} STREQUAL "NO" OR
419 ${var} STREQUAL "DEFAULT"))
421 "The `${var}` variable must be one of `YES`, `WANT`, `DONT_WANT`, `NO`, "
422 "or `DEFAULT`. Found `${${var}}`.")
426include("${CMAKE_CURRENT_LIST_DIR}/vtkTopologicalSort.cmake")
430@brief Scan modules and kits
432Once all of the modules and kits files have been found, they are "scanned" to
433determine what modules are enabled or required.
437 MODULE_FILES <file>...
438 [KIT_FILES <file>...]
439 PROVIDES_MODULES <variable>
440 [PROVIDES_KITS <variable>]
441 [REQUIRES_MODULES <variable>]
442 [REQUEST_MODULES <module>...]
443 [REJECT_MODULES <module>...]
444 [UNRECOGNIZED_MODULES <variable>]
445 [WANT_BY_DEFAULT <ON|OFF>]
446 [HIDE_MODULES_FROM_CACHE <ON|OFF>]
447 [ENABLE_TESTS <ON|OFF|WANT|DEFAULT>])
450The `MODULE_FILES` and `PROVIDES_MODULES` arguments are required. Modules which
451refer to kits must be scanned at the same time as their kits. This is so that
452modules may not add themselves to kits declared prior. The arguments are as follows:
454 * `MODULE_FILES`: (Required) The list of module files to scan.
455 * `KIT_FILES`: The list of kit files to scan.
456 * `PROVIDES_MODULES`: (Required) This variable will contain the list of
457 modules which are enabled due to this scan.
458 * `PROVIDES_KITS`: (Required if `KIT_FILES` are provided) This variable will
459 contain the list of kits which are enabled due to this scan.
460 * `REQUIRES_MODULES`: This variable will contain the list of modules required
461 by the enabled modules that were not scanned.
462 * `REQUEST_MODULES`: The list of modules required by previous scans.
463 * `REJECT_MODULES`: The list of modules to exclude from the scan. If any of
464 these modules are required, an error will be raised.
465 * `UNRECOGNIZED_MODULES`: This variable will contain the list of requested
466 modules that were not scanned.
467 * `WANT_BY_DEFAULT`: (Defaults to `OFF`) Whether modules should default to
469 * `HIDE_MODULES_FROM_CACHE`: (Defaults to `OFF`) Whether or not to hide the
470 control variables from the cache or not. If enabled, modules will not be
471 built unless they are required elsewhere.
472 * `ENABLE_TESTS`: (Defaults to `DEFAULT`) Whether or not modules required by
473 the tests for the scanned modules should be enabled or not.
474 - `ON`: Modules listed as `TEST_DEPENDS` will be required.
475 - `OFF`: Test modules will not be considered.
476 - `WANT`: Test dependencies will enable modules if possible. Note that this
477 has known issues where modules required only via testing may not have
478 their dependencies enabled.
479 - `DEFAULT`: Test modules will be enabled if their required dependencies
480 are satisfied and skipped otherwise.
482To make error messages clearer, modules passed to `REQUIRES_MODULES` and
483`REJECT_MODULES` may have a `_vtk_module_reason_<MODULE>` variable set to the
484reason for the module appearing in either argument. For example, if the
485`Package::Frobnitz` module is required due to a `ENABLE_FROBNITZ` cache
489set("_vtk_module_reason_Package::Frobnitz"
490 "via the `ENABLE_FROBNITZ` setting")
493Additionally, the reason for the `WANT_BY_DEFAULT` value may be provided via
494the `_vtk_module_reason_WANT_BY_DEFAULT` variable.
496@section module-scanning-multiple Scanning multiple groups of modules
498When scanning complicated projects, multiple scans may be required to get
499defaults set properly. The `REQUIRES_MODULES`, `REQUEST_MODULES`, and
500`UNRECOGNIZED_MODULES` arguments are meant to deal with this case. As an
501example, imagine a project with its source code, third party dependencies, as
502well as some utility modules which should only be built as necessary. Here, the
503project would perform three scans, one for each "grouping" of modules:
506# Scan our modules first because we need to know what of the other groups we
508vtk_module_find_modules(our_modules "${CMAKE_CURRENT_SOURCE_DIR}/src")
510 MODULE_FILES ${our_modules}
511 PROVIDES_MODULES our_enabled_modules
512 REQUIRES_MODULES required_modules)
514# Scan the third party modules, requesting only those that are necessary, but
515# allowing them to be toggled during the build.
516vtk_module_find_modules(third_party_modules "${CMAKE_CURRENT_SOURCE_DIR}/third-party")
518 MODULE_FILES ${third_party_modules}
519 PROVIDES_MODULES third_party_enabled_modules
520 # These modules were requested by an earlier scan.
521 REQUEST_MODULES ${required_modules}
522 REQUIRES_MODULES required_modules
523 UNRECOGNIZED_MODULES unrecognized_modules)
525# These modules are internal and should only be built if necessary. There is no
526# need to support them being enabled independently, so hide them from the
528vtk_module_find_modules(utility_modules "${CMAKE_CURRENT_SOURCE_DIR}/utilities")
530 MODULE_FILES ${utility_modules}
531 PROVIDES_MODULES utility_enabled_modules
532 # These modules were either requested or unrecognized by an earlier scan.
533 REQUEST_MODULES ${required_modules}
534 ${unrecognized_modules}
535 REQUIRES_MODULES required_modules
536 UNRECOGNIZED_MODULES unrecognized_modules
537 HIDE_MODULES_FROM_CACHE ON)
539if (required_modules OR unrecognized_modules)
540 # Not all of the modules we required were found. This should probably error out.
544function (vtk_module_scan)
545 cmake_parse_arguments(PARSE_ARGV 0 _vtk_scan
547 "WANT_BY_DEFAULT;HIDE_MODULES_FROM_CACHE;PROVIDES_MODULES;REQUIRES_MODULES;UNRECOGNIZED_MODULES;ENABLE_TESTS;PROVIDES_KITS
"
548 "MODULE_FILES;KIT_FILES;REQUEST_MODULES;REJECT_MODULES
")
550 if (_vtk_scan_UNPARSED_ARGUMENTS)
553 "${_vtk_scan_UNPARSED_ARGUMENTS}
")
556 if (NOT DEFINED _vtk_scan_WANT_BY_DEFAULT)
557 set(_vtk_scan_WANT_BY_DEFAULT OFF)
560 if (NOT DEFINED _vtk_scan_HIDE_MODULES_FROM_CACHE)
561 set(_vtk_scan_HIDE_MODULES_FROM_CACHE OFF)
564 if (NOT DEFINED _vtk_scan_PROVIDES_MODULES)
566 "The `PROVIDES_MODULES` argument is required.
")
569 if (NOT DEFINED _vtk_scan_PROVIDES_KITS AND _vtk_scan_KIT_FILES)
571 "The `PROVIDES_KITS` argument is required.
")
574 if (NOT DEFINED _vtk_scan_ENABLE_TESTS)
575 set(_vtk_scan_ENABLE_TESTS "DEFAULT
")
578 if (NOT (_vtk_scan_ENABLE_TESTS STREQUAL "ON
" OR
579 _vtk_scan_ENABLE_TESTS STREQUAL "OFF
" OR
580 _vtk_scan_ENABLE_TESTS STREQUAL "WANT
" OR
581 _vtk_scan_ENABLE_TESTS STREQUAL "DEFAULT
"))
583 "The `ENABLE_TESTS` argument must be one of `ON`, `OFF`, `WANT`, or
"
584 "`DEFAULT`.
" "Received `${_vtk_scan_ENABLE_TESTS}`.
")
587 if (NOT _vtk_scan_MODULE_FILES)
589 "No
module files given to scan.")
592 set(_vtk_scan_option_default_type STRING)
593 if (_vtk_scan_HIDE_MODULES_FROM_CACHE)
594 set(_vtk_scan_option_default_type INTERNAL)
597 set(_vtk_scan_all_kits)
599 foreach (_vtk_scan_kit_file IN LISTS _vtk_scan_KIT_FILES)
600 if (NOT IS_ABSOLUTE "${_vtk_scan_kit_file}")
601 string(PREPEND _vtk_scan_kit_file "${CMAKE_CURRENT_SOURCE_DIR}/")
603 set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" APPEND
605 CMAKE_CONFIGURE_DEPENDS "${_vtk_scan_kit_file}")
607 file(READ "${_vtk_scan_kit_file}" _vtk_scan_kit_args)
609 string(REGEX REPLACE "#[^\n]*\n" "\n" _vtk_scan_kit_args "${_vtk_scan_kit_args}")
610 # Use argument splitting.
611 string(REGEX REPLACE "( |\n)+" ";
" _vtk_scan_kit_args "${_vtk_scan_kit_args}
")
612 _vtk_module_parse_kit_args(_vtk_scan_kit_name ${_vtk_scan_kit_args})
613 _vtk_module_debug(kit "@_vtk_scan_kit_name@ declared by @_vtk_scan_kit_file
@")
615 list(APPEND _vtk_scan_all_kits
616 "${_vtk_scan_kit_name}
")
618 # Set properties for building.
621 "_vtk_kit_${_vtk_scan_kit_name}_namespace
" "${${_vtk_scan_kit_name}_NAMESPACE}
")
624 "_vtk_kit_${_vtk_scan_kit_name}_target_name
" "${${_vtk_scan_kit_name}_TARGET_NAME}
")
627 "_vtk_kit_${_vtk_scan_kit_name}_library_name
" "${${_vtk_scan_kit_name}_LIBRARY_NAME}
")
630 set(_vtk_scan_all_modules)
631 set(_vtk_scan_all_groups)
632 set(_vtk_scan_rejected_modules)
634 # Read all of the module files passed in.
635 foreach (_vtk_scan_module_file IN LISTS _vtk_scan_MODULE_FILES)
636 if (NOT IS_ABSOLUTE "${_vtk_scan_module_file}
")
637 string(PREPEND _vtk_scan_module_file "${CMAKE_CURRENT_SOURCE_DIR}/
")
639 set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}
" APPEND
641 CMAKE_CONFIGURE_DEPENDS "${_vtk_scan_module_file}
")
643 file(READ "${_vtk_scan_module_file}
" _vtk_scan_module_args)
645 string(REGEX REPLACE "#[^\n]*\n
" "\n
" _vtk_scan_module_args "${_vtk_scan_module_args}
")
646 # Use argument splitting.
647 string(REGEX REPLACE "( |\n)+
" ";
" _vtk_scan_module_args "${_vtk_scan_module_args}
")
648 _vtk_module_parse_module_args(_vtk_scan_module_name ${_vtk_scan_module_args})
649 _vtk_module_debug(module "@_vtk_scan_module_name@ declared by @_vtk_scan_module_file
@")
650 string(REPLACE "::
" "_
" _vtk_scan_module_name_safe "${_vtk_scan_module_name}
")
652 if (${_vtk_scan_module_name}_THIRD_PARTY)
653 if (_vtk_module_warnings)
654 if (${_vtk_scan_module_name}_EXCLUDE_WRAP)
656 "The third party ${_vtk_scan_module_name}
module does not need to "
657 "declare `EXCLUDE_WRAP` also.")
660 if (${_vtk_scan_module_name}_IMPLEMENTABLE)
662 "The third party ${_vtk_scan_module_name} module may not be "
665 if (${_vtk_scan_module_name}_IMPLEMENTS)
667 "The third party ${_vtk_scan_module_name} module may not "
668 "`IMPLEMENTS` another module.")
670 if (${_vtk_scan_module_name}_KIT)
672 "The third party ${_vtk_scan_module_name} module may not be part of "
673 "a kit (${${_vtk_scan_module_name}_KIT}).")
677 if (${_vtk_scan_module_name}_KIT)
678 if (NOT ${_vtk_scan_module_name}_KIT IN_LIST _vtk_scan_all_kits)
680 "The ${_vtk_scan_module_name} belongs to the "
681 "${${_vtk_scan_module_name}_KIT} kit, but it has not been scanned.")
685 # Check if the module is visible. Modules which have a failing condition
686 # are basically invisible.
687 if (DEFINED ${_vtk_scan_module_name}_CONDITION)
688 if (NOT (${${_vtk_scan_module_name}_CONDITION}))
689 if (DEFINED "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}")
690 set_property(CACHE "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}"
694 _vtk_module_debug(module "@_vtk_scan_module_name@ hidden by its `CONDITION`")
699 # Determine whether we should provide a user-visible option for this
701 set(_vtk_build_use_option 1)
702 if (DEFINED _vtk_scan_REQUEST_MODULE)
703 if (_vtk_scan_module_name IN_LIST _vtk_scan_REQUEST_MODULE)
704 set("_vtk_scan_enable_${_vtk_scan_module_name}" YES)
705 set(_vtk_build_use_option 0)
708 if (DEFINED _vtk_scan_REJECT_MODULES)
709 if (_vtk_scan_module_name IN_LIST _vtk_scan_REJECT_MODULES)
710 if (NOT _vtk_build_use_option)
712 "The ${_vtk_scan_module_name} module has been requested and rejected.")
714 # Rejected modules should not have a build option.
715 set(_vtk_build_use_option 0)
716 list(APPEND _vtk_scan_rejected_modules
717 "${_vtk_scan_module_name}")
721 # Handle cache entries and determine the enabled state of the module from
722 # the relevant cache variables.
723 if (_vtk_build_use_option)
724 set("VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}" "DEFAULT"
725 CACHE STRING "Enable the ${_vtk_scan_module_name} module. ${${_vtk_scan_module_name}_DESCRIPTION}")
726 mark_as_advanced("VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}")
727 set_property(CACHE "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}"
729 STRINGS "YES;WANT;DONT_WANT;NO;DEFAULT
")
730 _vtk_module_verify_enable_value("VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
")
732 if (NOT VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe} STREQUAL "DEFAULT
")
733 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "${VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}}
")
734 set("_vtk_scan_enable_reason_${_vtk_scan_module_name}
"
735 "via `VTK_MDDULE_ENABLE_${_vtk_scan_module_name_safe}`
")
736 _vtk_module_debug(enable "@_vtk_scan_module_name@ is `${_vtk_scan_enable_${_vtk_scan_module_name}}` by cache
value")
739 # Check the state of any groups the module belongs to.
740 foreach (_vtk_scan_group IN LISTS "${_vtk_scan_module_name}_GROUPS
")
741 if (NOT DEFINED "VTK_GROUP_ENABLE_${_vtk_scan_group}
")
742 set(_vtk_scan_group_default "DEFAULT
")
743 if (DEFINED "_vtk_module_group_default_${_vtk_scan_group}
")
744 set(_vtk_scan_group_default "${_vtk_module_group_default_${_vtk_scan_group}}
")
746 set("VTK_GROUP_ENABLE_${_vtk_scan_group}
" "${_vtk_scan_group_default}
"
747 CACHE STRING "Enable the ${_vtk_scan_group} group modules.
")
748 set_property(CACHE "VTK_GROUP_ENABLE_${_vtk_scan_group}
"
750 STRINGS "YES;WANT;DONT_WANT;NO;DEFAULT
")
751 set_property(CACHE "VTK_GROUP_ENABLE_${_vtk_scan_group}
"
753 TYPE "${_vtk_scan_option_default_type}
")
755 _vtk_module_verify_enable_value("VTK_GROUP_ENABLE_${_vtk_scan_group}
")
757 if (NOT VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe} STREQUAL "DEFAULT
")
761 # Determine the state of the group.
762 set(_vtk_scan_group_enable "${VTK_GROUP_ENABLE_${_vtk_scan_group}}
")
763 if (NOT _vtk_scan_group_enable STREQUAL "DEFAULT
")
764 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "${_vtk_scan_group_enable}
")
765 set("_vtk_scan_enable_reason_${_vtk_scan_module_name}
"
766 "via `VTK_GROUP_ENABLE_${_vtk_scan_group}`
")
767 _vtk_module_debug(enable "@_vtk_scan_module_name@ is DEFAULT,
using group `@_vtk_scan_group@` setting: @_vtk_scan_group_enable
@")
771 set_property(CACHE "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
"
773 TYPE "${_vtk_scan_option_default_type}
")
776 if (NOT DEFINED "_vtk_scan_enable_${_vtk_scan_module_name}
" AND
777 VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe} STREQUAL "DEFAULT
")
778 if (_vtk_scan_WANT_BY_DEFAULT)
779 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "WANT
")
781 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "DONT_WANT
")
783 if (DEFINED _vtk_module_reason_WANT_BY_DEFAULT)
784 set("_vtk_scan_enable_reason_${_vtk_scan_module_name}
"
785 "${_vtk_module_reason_WANT_BY_DEFAULT}
")
787 set("_vtk_scan_enable_reason_${_vtk_scan_module_name}
"
788 "via `WANT_BY_DEFAULT=${_vtk_scan_WANT_BY_DEFAULT}`
")
790 _vtk_module_debug(enable "@_vtk_scan_module_name@ is DEFAULT,
using `WANT_BY_DEFAULT`: ${_vtk_scan_enable_reason_${_vtk_scan_module_name}}
")
793 list(APPEND _vtk_scan_all_modules
794 "${_vtk_scan_module_name}
")
795 set("_vtk_scan_${_vtk_scan_module_name}_all_depends
"
796 ${${_vtk_scan_module_name}_DEPENDS}
797 ${${_vtk_scan_module_name}_PRIVATE_DEPENDS})
799 if (${_vtk_scan_module_name}_THIRD_PARTY)
800 set("${_vtk_scan_module_name}_EXCLUDE_WRAP
" TRUE)
801 set("${_vtk_scan_module_name}_IMPLEMENTABLE
" FALSE)
802 set("${_vtk_scan_module_name}_IMPLEMENTS
")
805 if (${_vtk_scan_module_name}_KIT)
806 _vtk_module_debug(kit "@_vtk_scan_module_name@ belongs to the ${${_vtk_scan_module_name}_KIT} kit
")
809 # Set properties for building.
812 "_vtk_module_${_vtk_scan_module_name}_file
" "${_vtk_scan_module_file}
")
815 "_vtk_module_${_vtk_scan_module_name}_namespace
" "${${_vtk_scan_module_name}_NAMESPACE}
")
818 "_vtk_module_${_vtk_scan_module_name}_target_name
" "${${_vtk_scan_module_name}_TARGET_NAME}
")
821 "_vtk_module_${_vtk_scan_module_name}_library_name
" "${${_vtk_scan_module_name}_LIBRARY_NAME}
")
824 "_vtk_module_${_vtk_scan_module_name}_third_party
" "${${_vtk_scan_module_name}_THIRD_PARTY}
")
827 "_vtk_module_${_vtk_scan_module_name}_exclude_wrap
" "${${_vtk_scan_module_name}_EXCLUDE_WRAP}
")
830 "_vtk_module_${_vtk_scan_module_name}_kit
" "${${_vtk_scan_module_name}_KIT}
")
833 "_vtk_module_${_vtk_scan_module_name}_depends
" "${${_vtk_scan_module_name}_DEPENDS}
")
836 "_vtk_module_${_vtk_scan_module_name}_order_depends
" "${${_vtk_scan_module_name}_ORDER_DEPENDS}
")
839 "_vtk_module_${_vtk_scan_module_name}_private_depends
" "${${_vtk_scan_module_name}_PRIVATE_DEPENDS}
")
842 "_vtk_module_${_vtk_scan_module_name}_optional_depends
" "${${_vtk_scan_module_name}_OPTIONAL_DEPENDS}
")
845 "_vtk_module_${_vtk_scan_module_name}_test_depends
" "${${_vtk_scan_module_name}_TEST_DEPENDS}
")
848 "_vtk_module_${_vtk_scan_module_name}_test_optional_depends
" "${${_vtk_scan_module_name}_TEST_OPTIONAL_DEPENDS}
")
851 "_vtk_module_${_vtk_scan_module_name}_test_labels
" "${${_vtk_scan_module_name}_TEST_LABELS}
")
854 "_vtk_module_${_vtk_scan_module_name}_implements
" "${${_vtk_scan_module_name}_IMPLEMENTS}
")
857 "_vtk_module_${_vtk_scan_module_name}_implementable
" "${${_vtk_scan_module_name}_IMPLEMENTABLE}
")
858 # create absolute path for license files
860 foreach (_license_file IN LISTS ${_vtk_scan_module_name}_LICENSE_FILES)
861 if (NOT IS_ABSOLUTE "${_license_file}
")
862 get_filename_component(_vtk_scan_module_dir "${_vtk_scan_module_file}
" DIRECTORY)
863 string(PREPEND _license_file "${_vtk_scan_module_dir}/
")
865 list(APPEND _license_files "${_license_file}
")
869 "_vtk_module_${_vtk_scan_module_name}_license_files
" "${_license_files}
")
870 if (_vtk_scan_ENABLE_TESTS STREQUAL "WANT
")
873 "_vtk_module_${_vtk_scan_module_name}_enable_tests_by_want
" "1
")
877 set(_vtk_scan_current_modules "${_vtk_scan_all_modules}
")
878 vtk_topological_sort(_vtk_scan_all_modules "_vtk_scan_
" "_all_depends
")
880 set(_vtk_scan_provided_modules)
881 set(_vtk_scan_required_modules)
882 set(_vtk_scan_disabled_modules)
884 # Seed the `_vtk_scan_provide_` variables with modules requested and rejected
886 foreach (_vtk_scan_request_module IN LISTS _vtk_scan_REQUEST_MODULES)
887 set("_vtk_scan_provide_${_vtk_scan_request_module}
" ON)
888 if (DEFINED "_vtk_module_reason_${_vtk_scan_request_module}
")
889 set("_vtk_scan_provide_reason_${_vtk_scan_request_module}
"
890 "${_vtk_module_reason_${_vtk_scan_request_module}}
")
892 set("_vtk_scan_provide_reason_${_vtk_scan_request_module}
"
893 "via `REQUEST_MODULES`
")
895 _vtk_module_debug(provide "@_vtk_scan_request_module@ is provided ${_vtk_scan_provide_reason_${_vtk_scan_request_module}}
")
897 foreach (_vtk_scan_reject_module IN LISTS _vtk_scan_REJECT_MODULES)
898 set("_vtk_scan_provide_${_vtk_scan_reject_module}
" OFF)
899 if (DEFINED "_vtk_module_reason_${_vtk_scan_reject_module}
")
900 set("_vtk_scan_provide_reason_${_vtk_scan_reject_module}
"
901 "${_vtk_module_reason_${_vtk_scan_reject_module}}
")
903 set("_vtk_scan_provide_reason_${_vtk_scan_reject_module}
"
904 "via `REJECT_MODULES`
")
906 _vtk_module_debug(provide "@_vtk_scan_reject_module@ is not provided ${_vtk_scan_provide_reason_${_vtk_scan_reject_module}}
")
909 # Traverse the graph classifying the quad-state for enabling modules into a
910 # boolean stored in the `_vtk_scan_provide_` variables.
911 foreach (_vtk_scan_module IN LISTS _vtk_scan_all_modules)
912 if (NOT _vtk_scan_module IN_LIST _vtk_scan_current_modules)
913 _vtk_module_debug(provide "@_vtk_scan_module@ is ignored because it is not in the current scan set
")
917 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module}
")
919 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "YES
")
920 # Mark enabled modules as to-be-provided. Any errors with requiring a
921 # disabled module will be dealt with later.
922 set("_vtk_scan_provide_${_vtk_scan_module}
" ON)
923 set("_vtk_scan_provide_reason_${_vtk_scan_module}
"
924 "via a `YES` setting (${_vtk_scan_enable_reason_${_vtk_scan_module}})
")
925 _vtk_module_debug(provide "@_vtk_scan_module@ is provided due to `YES` setting
")
926 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "WANT
")
927 # Check to see if we can provide this module by checking of any of its
928 # dependencies have been disabled.
929 set(_vtk_scan_test_depends)
930 if (NOT ${_vtk_scan_module}_THIRD_PARTY AND _vtk_scan_ENABLE_TESTS STREQUAL "ON
")
931 # If the tests have to be on, we also need the test dependencies.
932 set(_vtk_scan_test_depends "${${_vtk_scan_module}_TEST_DEPENDS}
")
935 set("_vtk_scan_provide_${_vtk_scan_module}
" ON)
936 set("_vtk_scan_provide_reason_${_vtk_scan_module}
"
937 "via a `WANT` setting (${_vtk_scan_enable_reason_${_vtk_scan_module}})
")
938 _vtk_module_debug(provide "@_vtk_scan_module@ is provided due to `WANT` setting
")
939 foreach (_vtk_scan_module_depend IN LISTS "${_vtk_scan_module}_DEPENDS
" "${_vtk_scan_module}_PRIVATE_DEPENDS
" _vtk_scan_test_depends)
940 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module_depend}
" AND NOT _vtk_scan_provide_${_vtk_scan_module_depend})
941 set("_vtk_scan_provide_${_vtk_scan_module}
" OFF)
942 set("_vtk_scan_provide_reason_${_vtk_scan_module}
"
943 "due to the ${_vtk_scan_module_depend}
module not being available")
944 if (DEFINED "_vtk_scan_provide_reason_${_vtk_scan_module_depend}")
945 string(APPEND "_vtk_scan_provide_reason_${_vtk_scan_module}"
946 " (${_vtk_scan_provide_reason_${_vtk_scan_module_depend}})")
948 _vtk_module_debug(provide "@_vtk_scan_module@ is not provided due to not provided dependency @_vtk_scan_module_depend
@")
952 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "DONT_WANT")
953 # Check for disabled dependencies and disable if so.
954 foreach (_vtk_scan_module_depend IN LISTS "${_vtk_scan_module}_DEPENDS" "${_vtk_scan_module}_PRIVATE_DEPENDS" _vtk_scan_test_depends)
955 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module_depend}" AND NOT _vtk_scan_provide_${_vtk_scan_module_depend})
956 set("_vtk_scan_provide_${_vtk_scan_module}" OFF)
957 set("_vtk_scan_provide_reason_${_vtk_scan_module}"
958 "due to the ${_vtk_scan_module_depend} module not being available")
959 if (DEFINED "_vtk_scan_provide_reason_${_vtk_scan_module_depend}")
960 string(APPEND "_vtk_scan_provide_reason_${_vtk_scan_module}"
961 " (${_vtk_scan_provide_reason_${_vtk_scan_module_depend}})")
963 _vtk_module_debug(provide "@_vtk_scan_module@ is not provided due to not provided dependency @_vtk_scan_module_depend
@")
967 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "NO")
968 # Disable the module.
969 set("_vtk_scan_provide_${_vtk_scan_module}" OFF)
970 set("_vtk_scan_provide_reason_${_vtk_scan_module}"
971 "via a `NO` setting (${_vtk_scan_enable_reason_${_vtk_scan_module}})")
972 _vtk_module_debug(provide "@_vtk_scan_module@ is not provided due to `NO` setting")
975 # Collect disabled modules into a list.
976 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module}" AND NOT _vtk_scan_provide_${_vtk_scan_module})
977 list(APPEND _vtk_scan_disabled_modules
978 "${_vtk_scan_module}")
981 if (NOT DEFINED "_vtk_scan_provide_${_vtk_scan_module}")
982 _vtk_module_debug(provide "@_vtk_scan_module@ is indeterminate (${_vtk_scan_enable_${_vtk_scan_module}})")
986 # Scan all modules from the top of tree to the bottom.
987 list(REVERSE _vtk_scan_all_modules)
988 foreach (_vtk_scan_module IN LISTS _vtk_scan_all_modules)
989 if (NOT _vtk_scan_module IN_LIST _vtk_scan_current_modules)
993 # If we're providing this module...
994 if (_vtk_scan_provide_${_vtk_scan_module})
995 list(APPEND _vtk_scan_provided_modules
996 "${_vtk_scan_module}")
998 # Grab any test dependencies that are required.
999 set(_vtk_scan_test_depends)
1000 set(_vtk_scan_test_wants)
1001 if (NOT ${_vtk_scan_module}_THIRD_PARTY)
1002 if (_vtk_scan_ENABLE_TESTS STREQUAL "ON")
1003 set_property(GLOBAL APPEND
1005 "_vtk_module_test_modules" "${_vtk_scan_module}")
1006 set(_vtk_scan_test_depends "${${_vtk_scan_module}_TEST_DEPENDS}")
1007 elseif (_vtk_scan_ENABLE_TESTS STREQUAL "WANT")
1008 set_property(GLOBAL APPEND
1010 "_vtk_module_test_modules" "${_vtk_scan_module}")
1011 set(_vtk_scan_test_wants _vtk_scan_wants_marker ${${_vtk_scan_module}_TEST_DEPENDS})
1012 elseif (_vtk_scan_ENABLE_TESTS STREQUAL "DEFAULT")
1013 set_property(GLOBAL APPEND
1015 "_vtk_module_test_modules" "${_vtk_scan_module}")
1016 elseif (_vtk_scan_ENABLE_TESTS STREQUAL "OFF")
1020 "Unrecognized option for ENABLE_TESTS: ${_vtk_module_ENABLE_TESTS}.")
1024 # Add all dependent modules to the list of required or provided modules.
1025 set(_vtk_scan_is_wanting 0)
1026 foreach (_vtk_scan_module_depend IN LISTS "${_vtk_scan_module}_DEPENDS" "${_vtk_scan_module}_PRIVATE_DEPENDS" _vtk_scan_test_depends _vtk_scan_test_wants)
1027 if (_vtk_scan_module_depend STREQUAL "_vtk_scan_wants_marker")
1028 set(_vtk_scan_is_wanting 1)
1031 # Though we need to error if this would cause a disabled module to be
1033 if (_vtk_scan_module_depend IN_LIST _vtk_scan_disabled_modules)
1034 if (_vtk_scan_is_wanting)
1038 "The ${_vtk_scan_module} module (enabled "
1039 "${_vtk_scan_provide_reason_${_vtk_scan_module}}) requires the "
1040 "disabled module ${_vtk_scan_module_depend} (disabled "
1041 "${_vtk_scan_provide_reason_${_vtk_scan_module_depend}}).")
1045 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module_depend}")
1046 if (NOT _vtk_scan_provide_${_vtk_scan_module_depend})
1048 "The ${_vtk_scan_module_depend} module (disabled "
1049 "${_vtk_scan_provide_reason_${_vtk_scan_module_depend}}) should "
1050 "be provided because it is required by ${_vtk_scan_module} "
1051 "(${_vtk_scan_provide_reason_${_vtk_scan_module}})")
1055 set("_vtk_scan_provide_reason_${_vtk_scan_module_depend}"
1056 "via dependency from ${_vtk_scan_module}")
1057 if (DEFINED "_vtk_scan_provide_reason_${_vtk_scan_module}")
1058 string(APPEND "_vtk_scan_provide_reason_${_vtk_scan_module_depend}"
1059 " (${_vtk_scan_provide_reason_${_vtk_scan_module}})")
1061 set("_vtk_scan_provide_${_vtk_scan_module_depend}" ON)
1063 if (NOT _vtk_scan_module_depend IN_LIST _vtk_scan_current_modules)
1064 if (NOT TARGET "${_vtk_scan_module_depend}")
1065 _vtk_module_debug(provide "@_vtk_scan_module_depend@ is external and required due to dependency from @_vtk_scan_module
@")
1067 list(APPEND _vtk_scan_required_modules
1068 "${_vtk_scan_module_depend}")
1070 _vtk_module_debug(provide "@_vtk_scan_module_depend@ is provided due to dependency from @_vtk_scan_module
@")
1071 list(APPEND _vtk_scan_provided_modules
1072 "${_vtk_scan_module_depend}")
1078 if (_vtk_scan_provided_modules)
1079 list(REMOVE_DUPLICATES _vtk_scan_provided_modules)
1082 set(_vtk_scan_provided_kits)
1084 # Build a list of kits which contain the provided modules.
1085 foreach (_vtk_scan_provided_module IN LISTS _vtk_scan_provided_modules)
1086 if (${_vtk_scan_provided_module}_KIT)
1087 list(APPEND _vtk_scan_provided_kits
1088 "${${_vtk_scan_provided_module}_KIT}")
1089 set_property(GLOBAL APPEND
1091 "_vtk_kit_${${_vtk_scan_provided_module}_KIT}_kit_modules" "${_vtk_scan_provided_module}")
1095 if (_vtk_scan_provided_kits)
1096 list(REMOVE_DUPLICATES _vtk_scan_provided_kits)
1099 if (_vtk_scan_required_modules)
1100 list(REMOVE_DUPLICATES _vtk_scan_required_modules)
1103 set(_vtk_scan_unrecognized_modules
1104 ${_vtk_scan_REQUEST_MODULES}
1105 ${_vtk_scan_REJECT_MODULES})
1107 if (_vtk_scan_unrecognized_modules AND (_vtk_scan_provided_modules OR _vtk_scan_rejected_modules))
1108 list(REMOVE_ITEM _vtk_scan_unrecognized_modules
1109 ${_vtk_scan_provided_modules}
1110 ${_vtk_scan_rejected_modules})
1113 set("${_vtk_scan_PROVIDES_MODULES}"
1114 ${_vtk_scan_provided_modules}
1117 if (DEFINED _vtk_scan_REQUIRES_MODULES)
1118 set("${_vtk_scan_REQUIRES_MODULES}"
1119 ${_vtk_scan_required_modules}
1123 if (DEFINED _vtk_scan_UNRECOGNIZED_MODULES)
1124 set("${_vtk_scan_UNRECOGNIZED_MODULES}"
1125 ${_vtk_scan_unrecognized_modules}
1129 if (DEFINED _vtk_scan_PROVIDES_KITS)
1130 set("${_vtk_scan_PROVIDES_KITS}"
1131 ${_vtk_scan_provided_kits}
1137@page module-overview
1139@section module-target-functions Module-as-target functions
1141Due to the nature of VTK modules supporting being built as kits, the module
1142name might not be usable as a target to CMake's `target_` family of commands.
1143Instead, there are various wrappers around them which take the module name as
1144an argument. These handle the forwarding of relevant information to the kit
1145library as well where necessary.
1147 - @ref vtk_module_set_properties
1148 - @ref vtk_module_set_property
1149 - @ref vtk_module_get_property
1150 - @ref vtk_module_depend
1151 - @ref vtk_module_include
1152 - @ref vtk_module_definitions
1153 - @ref vtk_module_compile_options
1154 - @ref vtk_module_compile_features
1155 - @ref vtk_module_link
1156 - @ref vtk_module_link_options
1160@page module-internal-api
1162@section module-target-internals Module target internals
1164When manipulating modules as targets, there are a few functions provided for
1165use in wrapping code to more easily access them.
1167 - @ref _vtk_module_real_target
1168 - @ref _vtk_module_real_target_kit
1172@ingroup module-internal
1173@brief The real target for a module
1176_vtk_module_real_target(<var> <module>)
1179Sometimes the actual, core target for a module is required (e.g., setting
1180CMake-level target properties or install rules). This function returns the real
1183function (_vtk_module_real_target var module)
1186 "Unparsed arguments for _vtk_module_real_target: ${ARGN}.")
1189 set(_vtk_real_target_res "")
1190 if (TARGET "${module}")
1191 get_property(_vtk_real_target_imported
1194 if (_vtk_real_target_imported)
1195 set(_vtk_real_target_res "${module}")
1199 if (NOT _vtk_real_target_res)
1200 get_property(_vtk_real_target_res GLOBAL
1201 PROPERTY "_vtk_module_${module}_target_name")
1202 # Querying during the build.
1203 if (DEFINED _vtk_build_BUILD_WITH_KITS AND _vtk_build_BUILD_WITH_KITS)
1204 get_property(_vtk_real_target_kit GLOBAL
1205 PROPERTY "_vtk_module_${module}_kit")
1206 if (_vtk_real_target_kit)
1207 string(APPEND _vtk_real_target_res "-objects")
1209 # A query for after the module is built.
1210 elseif (TARGET "${_vtk_real_target_res}-objects")
1211 string(APPEND _vtk_real_target_res "-objects")
1215 if (NOT _vtk_real_target_res)
1216 set(_vtk_real_target_msg "")
1217 if (NOT TARGET "${module}")
1218 if (DEFINED _vtk_build_module)
1219 set(_vtk_real_target_msg
1220 " Is a module dependency missing?")
1221 elseif (TARGET "${module}")
1222 set(_vtk_real_target_msg
1223 " It's a target, but is it a VTK module?")
1225 set(_vtk_real_target_msg
1226 " The module name is not a CMake target. Is there a typo? Is it missing a `Package::` prefix? Is a `find_package` missing a required component?")
1230 "Failed to determine the real target for the `${module}` "
1231 "module.${_vtk_real_target_msg}")
1235 "${_vtk_real_target_res}"
1240@ingroup module-internal
1241@brief The real target for a kit
1244_vtk_module_real_target_kit(<var> <kit>)
1247Sometimes the actual, core target for a module is required (e.g., setting
1248CMake-level target properties or install rules). This function returns the real
1251function (_vtk_module_real_target_kit var kit)
1254 "Unparsed arguments for _vtk_module_real_target_kit: ${ARGN}.")
1257 set(_vtk_real_target_res "")
1258 if (TARGET "${kit}")
1259 get_property(_vtk_real_target_imported
1262 if (_vtk_real_target_imported)
1263 set(_vtk_real_target_res "${kit}")
1267 if (NOT _vtk_real_target_res)
1268 get_property(_vtk_real_target_res GLOBAL
1269 PROPERTY "_vtk_kit_${kit}_target_name")
1272 if (NOT _vtk_real_target_res)
1274 "Failed to determine the real target for the `${kit}` kit.")
1278 "${_vtk_real_target_res}"
1284@brief Set multiple properties on a module
1286A wrapper around `set_target_properties` that works for modules.
1289vtk_module_set_properties(<module>
1290 [<property> <value>]...)
1293function (vtk_module_set_properties module)
1294 _vtk_module_real_target(_vtk_set_properties_target "${module}")
1296 set_target_properties("${_vtk_set_properties_target}"
1303@brief Set a property on a module
1305A wrapper around `set_property(TARGET)` that works for modules.
1308vtk_module_set_property(<module>
1309 [APPEND] [APPEND_STRING]
1314function (vtk_module_set_property module)
1315 cmake_parse_arguments(PARSE_ARGV 1 _vtk_property
1316 "APPEND;APPEND_STRING
"
1320 if (_vtk_property_UNPARSED_ARGUMENTS)
1323 "${_vtk_property_UNPARSED_ARGUMENTS}.
")
1326 if (NOT DEFINED _vtk_property_PROPERTY)
1328 "The `PROPERTY` argument is required.
")
1331 if (NOT DEFINED _vtk_property_VALUE)
1333 "The `VALUE` argument is required.
")
1336 if (_vtk_property_APPEND AND _vtk_property_APPEND_STRING)
1338 "`APPEND` and `APPEND_STRING` may not be used at the same
time.
")
1341 set(_vtk_property_args)
1342 if (_vtk_property_APPEND)
1343 list(APPEND _vtk_property_args
1346 if (_vtk_property_APPEND_STRING)
1347 list(APPEND _vtk_property_args
1351 _vtk_module_real_target(_vtk_property_target "${
module}")
1353 set_property(TARGET "${_vtk_property_target}"
1354 ${_vtk_property_args}
1356 "${_vtk_property_PROPERTY}" "${_vtk_property_VALUE}")
1361@brief Get a property from a module
1363A wrapper around `get_property(TARGET)` that works for modules.
1366vtk_module_get_property(<module>
1368 VARIABLE <variable>)
1371The variable name passed to the `VARIABLE` argument will be unset if the
1372property is not set (rather than the empty string).
1374function (vtk_module_get_property module)
1375 cmake_parse_arguments(PARSE_ARGV 1 _vtk_property
1380 if (_vtk_property_UNPARSED_ARGUMENTS)
1383 "${_vtk_property_UNPARSED_ARGUMENTS}.
")
1386 if (NOT DEFINED _vtk_property_PROPERTY)
1388 "The `PROPERTY` argument is required.
")
1391 if (NOT DEFINED _vtk_property_VARIABLE)
1393 "The `VARIABLE` argument is required.
")
1396 _vtk_module_real_target(_vtk_property_target "${
module}")
1398 get_property(_vtk_property_is_set
1399 TARGET "${_vtk_property_target}"
1400 PROPERTY "${_vtk_property_PROPERTY}"
1402 if (_vtk_property_is_set)
1403 get_property(_vtk_property_value
1404 TARGET "${_vtk_property_target}"
1405 PROPERTY "${_vtk_property_PROPERTY}")
1407 set("${_vtk_property_VARIABLE}"
1408 "${_vtk_property_value}"
1411 unset("${_vtk_property_VARIABLE}"
1418@brief Generate arguments for target function wrappers
1420Create the `INTERFACE`, `PUBLIC`, and `PRIVATE` arguments for a function
1421wrapping CMake's `target_` functions to call the wrapped function.
1423This is necessary because not all of the functions support empty lists given a
1426function (_vtk_module_target_function prefix)
1427 foreach (visibility IN ITEMS INTERFACE PUBLIC PRIVATE)
1428 if (${prefix}_${visibility})
1429 set("${prefix}_${visibility}_args"
1431 ${${prefix}_${visibility}}
1439@brief Add dependencies to a module
1441A wrapper around `add_dependencies` that works for modules.
1444vtk_module_depend(<module> <depend>...)
1447function (vtk_module_depend module)
1448 _vtk_module_real_target(_vtk_depend_target "${module}")
1450 add_dependencies("${_vtk_depend_target}"
1456@brief Add source files to a module
1458A wrapper around `target_sources` that works for modules.
1461vtk_module_sources(<module>
1462 [PUBLIC <source>...]
1463 [PRIVATE <source>...]
1464 [INTERFACE <source>...])
1467function (vtk_module_sources module)
1468 cmake_parse_arguments(PARSE_ARGV 1 _vtk_sources
1471 "INTERFACE;PUBLIC;PRIVATE
")
1473 if (_vtk_sources_UNPARSED_ARGUMENTS)
1476 "${_vtk_sources_UNPARSED_ARGUMENTS}.
")
1479 _vtk_module_real_target(_vtk_sources_target "${
module}")
1480 _vtk_module_target_function(_vtk_sources)
1482 if (NOT _vtk_sources_INTERFACE_args AND
1483 NOT _vtk_sources_PUBLIC_args AND
1484 NOT _vtk_sources_PRIVATE_args)
1488 target_sources("${_vtk_sources_target}"
1489 ${_vtk_sources_INTERFACE_args}
1490 ${_vtk_sources_PUBLIC_args}
1491 ${_vtk_sources_PRIVATE_args})
1496@brief Add include directories to a module
1498A wrapper around `target_include_directories` that works for modules.
1501vtk_module_include(<module>
1503 [PUBLIC <directory>...]
1504 [PRIVATE <directory>...]
1505 [INTERFACE <directory>...])
1508function (vtk_module_include module)
1509 cmake_parse_arguments(PARSE_ARGV 1 _vtk_include
1512 "INTERFACE;PUBLIC;PRIVATE
")
1514 if (_vtk_include_UNPARSED_ARGUMENTS)
1517 "${_vtk_include_UNPARSED_ARGUMENTS}.
")
1520 _vtk_module_real_target(_vtk_include_target "${
module}")
1521 _vtk_module_target_function(_vtk_include)
1523 set(_vtk_include_system_arg)
1524 if (_vtk_include_SYSTEM)
1525 set(_vtk_include_system_arg SYSTEM)
1528 if (NOT _vtk_include_INTERFACE_args AND
1529 NOT _vtk_include_PUBLIC_args AND
1530 NOT _vtk_include_PRIVATE_args)
1534 target_include_directories("${_vtk_include_target}"
1535 ${_vtk_include_system_arg}
1536 ${_vtk_include_INTERFACE_args}
1537 ${_vtk_include_PUBLIC_args}
1538 ${_vtk_include_PRIVATE_args})
1543@brief Add compile definitions to a module
1545A wrapper around `target_compile_definitions` that works for modules.
1548vtk_module_definitions(<module>
1549 [PUBLIC <define>...]
1550 [PRIVATE <define>...]
1551 [INTERFACE <define>...])
1554function (vtk_module_definitions module)
1555 cmake_parse_arguments(PARSE_ARGV 1 _vtk_definitions
1558 "INTERFACE;PUBLIC;PRIVATE
")
1560 if (_vtk_definitions_UNPARSED_ARGUMENTS)
1563 "${_vtk_definitions_UNPARSED_ARGUMENTS}.
")
1566 _vtk_module_real_target(_vtk_definitions_target "${
module}")
1567 _vtk_module_target_function(_vtk_definitions)
1569 if (NOT _vtk_definitions_INTERFACE_args AND
1570 NOT _vtk_definitions_PUBLIC_args AND
1571 NOT _vtk_definitions_PRIVATE_args)
1575 target_compile_definitions("${_vtk_definitions_target}"
1576 ${_vtk_definitions_INTERFACE_args}
1577 ${_vtk_definitions_PUBLIC_args}
1578 ${_vtk_definitions_PRIVATE_args})
1583@brief Add compile options to a module
1585A wrapper around `target_compile_options` that works for modules.
1588vtk_module_compile_options(<module>
1589 [PUBLIC <option>...]
1590 [PRIVATE <option>...]
1591 [INTERFACE <option>...])
1594function (vtk_module_compile_options module)
1595 cmake_parse_arguments(PARSE_ARGV 1 _vtk_compile_options
1598 "INTERFACE;PUBLIC;PRIVATE
")
1600 if (_vtk_compile_options_UNPARSED_ARGUMENTS)
1603 "${_vtk_compile_options_UNPARSED_ARGUMENTS}.
")
1606 _vtk_module_real_target(_vtk_compile_options_target "${
module}")
1607 _vtk_module_target_function(_vtk_compile_options)
1609 if (NOT _vtk_compile_options_INTERFACE_args AND
1610 NOT _vtk_compile_options_PUBLIC_args AND
1611 NOT _vtk_compile_options_PRIVATE_args)
1615 target_compile_options("${_vtk_compile_options_target}"
1616 ${_vtk_compile_options_INTERFACE_args}
1617 ${_vtk_compile_options_PUBLIC_args}
1618 ${_vtk_compile_options_PRIVATE_args})
1623@brief Add compile features to a module
1625A wrapper around `target_compile_features` that works for modules.
1628vtk_module_compile_features(<module>
1629 [PUBLIC <feature>...]
1630 [PRIVATE <feature>...]
1631 [INTERFACE <feature>...])
1634function (vtk_module_compile_features module)
1635 cmake_parse_arguments(PARSE_ARGV 1 _vtk_compile_features
1638 "INTERFACE;PUBLIC;PRIVATE
")
1640 if (_vtk_compile_features_UNPARSED_ARGUMENTS)
1643 "${_vtk_compile_features_UNPARSED_ARGUMENTS}.
")
1646 _vtk_module_real_target(_vtk_compile_features_target "${
module}")
1647 _vtk_module_target_function(_vtk_compile_features)
1649 if (NOT _vtk_compile_features_INTERFACE_args AND
1650 NOT _vtk_compile_features_PUBLIC_args AND
1651 NOT _vtk_compile_features_PRIVATE_args)
1655 target_compile_features("${_vtk_compile_features_target}"
1656 ${_vtk_compile_features_INTERFACE_args}
1657 ${_vtk_compile_features_PUBLIC_args}
1658 ${_vtk_compile_features_PRIVATE_args})
1663@brief Manage the private link target for a module
1665This function manages the private link target for a module.
1668_vtk_private_kit_link_target(<module>
1670 [SETUP_TARGET_NAME <var>]
1671 [USAGE_TARGET_NAME <var>])
1674function (_vtk_private_kit_link_target module)
1675 cmake_parse_arguments(_vtk_private_kit_link_target
1677 "SETUP_TARGET_NAME;USAGE_TARGET_NAME
"
1681 if (_vtk_private_kit_link_target_UNPARSED_ARGUMENTS)
1684 "${_vtk_private_kit_link_target_UNPARSED_ARGUMENTS}.
")
1687 # Compute the target name.
1688 get_property(_vtk_private_kit_link_base_target_name GLOBAL
1689 PROPERTY "_vtk_module_${
module}_target_name")
1690 if (NOT _vtk_private_kit_link_base_target_name)
1692 "_vtk_private_kit_link_target only works for modules built in the "
1696 set(_vtk_private_kit_link_target_setup_name
1697 "${_vtk_private_kit_link_base_target_name}-private-kit-links")
1698 get_property(_vtk_private_kit_link_namespace GLOBAL
1699 PROPERTY "_vtk_module_${module}_namespace")
1700 if (_vtk_private_kit_link_namespace)
1701 set(_vtk_private_kit_link_target_usage_name
1702 "${_vtk_private_kit_link_namespace}::${_vtk_private_kit_link_target_setup_name}")
1704 set(_vtk_private_kit_link_target_usage_name
1705 ":${_vtk_private_kit_link_target_setup_name}")
1708 # Create the target if requested.
1709 if (_vtk_private_kit_link_target_CREATE_IF_NEEDED AND
1710 NOT TARGET "${_vtk_private_kit_link_target_setup_name}")
1711 add_library("${_vtk_private_kit_link_target_setup_name}" INTERFACE)
1712 if (NOT _vtk_private_kit_link_target_setup_name STREQUAL _vtk_private_kit_link_target_usage_name)
1713 add_library("${_vtk_private_kit_link_target_usage_name}" ALIAS
1714 "${_vtk_private_kit_link_target_setup_name}")
1716 _vtk_module_install("${_vtk_private_kit_link_target_setup_name}")
1719 if (_vtk_private_kit_link_target_SETUP_TARGET_NAME)
1720 set("${_vtk_private_kit_link_target_SETUP_TARGET_NAME}"
1721 "${_vtk_private_kit_link_target_setup_name}"
1725 if (_vtk_private_kit_link_target_USAGE_TARGET_NAME)
1726 set("${_vtk_private_kit_link_target_USAGE_TARGET_NAME}"
1727 "${_vtk_private_kit_link_target_usage_name}"
1734@brief Add link libraries to a module
1736A wrapper around `target_link_libraries` that works for modules. Note that this
1737function does extra work in kit builds, so circumventing it may break in kit
1741vtk_module_link(<module>
1742 [PUBLIC <link item>...]
1743 [PRIVATE <link item>...]
1744 [INTERFACE <link item>...])
1747function (vtk_module_link module)
1748 cmake_parse_arguments(PARSE_ARGV 1 _vtk_link
1751 "INTERFACE;PUBLIC;PRIVATE
")
1753 if (_vtk_link_UNPARSED_ARGUMENTS)
1756 "${_vtk_link_UNPARSED_ARGUMENTS}.
")
1759 _vtk_module_real_target(_vtk_link_target "${
module}")
1760 _vtk_module_target_function(_vtk_link)
1762 get_property(_vtk_link_kit GLOBAL
1763 PROPERTY "_vtk_module_${module}_kit")
1765 if (_vtk_link_PRIVATE)
1766 _vtk_private_kit_link_target("${module}"
1768 SETUP_TARGET_NAME _vtk_link_private_kit_link_target)
1769 foreach (_vtk_link_private IN LISTS _vtk_link_PRIVATE)
1770 target_link_libraries("${_vtk_link_private_kit_link_target}"
1772 "$<LINK_ONLY:${_vtk_link_private}>")
1777 if (NOT _vtk_link_INTERFACE_args AND
1778 NOT _vtk_link_PUBLIC_args AND
1779 NOT _vtk_link_PRIVATE_args)
1783 target_link_libraries("${_vtk_link_target}"
1784 ${_vtk_link_INTERFACE_args}
1785 ${_vtk_link_PUBLIC_args}
1786 ${_vtk_link_PRIVATE_args})
1791@brief Add link options to a module
1793A wrapper around `target_link_options` that works for modules.
1796vtk_module_link_options(<module>
1797 [PUBLIC <option>...]
1798 [PRIVATE <option>...]
1799 [INTERFACE <option>...])
1802function (vtk_module_link_options module)
1803 cmake_parse_arguments(PARSE_ARGV 1 _vtk_link_options
1806 "INTERFACE;PUBLIC;PRIVATE
")
1808 if (_vtk_link_options_UNPARSED_ARGUMENTS)
1811 "${_vtk_link_options_UNPARSED_ARGUMENTS}.
")
1814 _vtk_module_real_target(_vtk_link_options_target "${
module}")
1815 _vtk_module_target_function(_vtk_link_options)
1817 if (NOT _vtk_link_options_INTERFACE_args AND
1818 NOT _vtk_link_options_PUBLIC_args AND
1819 NOT _vtk_link_options_PRIVATE_args)
1823 target_link_options("${_vtk_link_options_target}"
1824 ${_vtk_link_options_INTERFACE_args}
1825 ${_vtk_link_options_PUBLIC_args}
1826 ${_vtk_link_options_PRIVATE_args})
1830@page module-internal-api
1832@ingroup module-internal
1833@section module-properties Module properties
1835The VTK module system leverages CMake's target propagation and storage. As
1836such, there are a number of properties added to the targets representing
1837modules. These properties are intended for use by the module system and
1838associated functionality. In particular, more properties may be available by
1841@subsection module-properties-naming Naming properties
1843When creating properties for use with the module system, they should be
1844prefixed with `INTERFACE_vtk_module_`. The `INTERFACE_` portion is required in
1845order to work with interface libraries. The `vtk_module_` portion is to avoid
1846colliding with any other properties. This function assumes this naming scheme
1847for some of its convenience features as well.
1849Properties should be the same in the local build as well as when imported to
1852@subsection module-properties-system VTK module system properties
1854There are a number of properties that are used and expected by the core of the
1855module system. These are generally module metadata (module dependencies,
1856whether to wrap or not, etc.). The properties all have the
1857`INTERFACE_vtk_module_` prefix mentioned in the previous section.
1859 * `third_party`: If set, the module represents a third party
1860 dependency and should be treated specially. Third party modules are very
1861 restricted and generally do not have any other properties set on them.
1862 * `exclude_wrap`: If set, the module should not be wrapped by an external
1864 * `depends`: The list of dependent modules. Language wrappers will generally
1865 require this to satisfy references to parent classes of the classes in the
1867 * `private_depends`: The list of privately dependent modules. Language
1868 wrappers may require this to satisfy references to parent classes of the
1869 classes in the module.
1870 * `optional_depends`: The list of optionally dependent modules. Language
1871 wrappers may require this to satisfy references to parent classes of the
1872 classes in the module.
1873 * `kit`: The kit the module is a member of. Only set if the module is
1874 actually a member of the kit (i.e., the module was built with
1875 `BUILD_WITH_KITS ON`).
1876 * `implements`: The list of modules for which this module registers to. This
1877 is used by the autoinit subsystem and generally is not required.
1878 * `implementable`: If set, this module provides registries which may be
1879 populated by dependent modules. It is used to check the `implements`
1880 property to help minimize unnecessary work from the autoinit subsystem.
1881 * `needs_autoinit`: If set, linking to this module requires the autoinit
1882 subsystem to ensure that registries in modules are fully populated.
1883 * `headers`: Paths to the public headers from the module. These are the
1884 headers which should be handled by language wrappers.
1885 * `hierarchy`: The path to the hierarchy file describing inheritance of the
1886 classes for use in language wrappers.
1887 * `forward_link`: Usage requirements that must be forwarded even though the
1888 module is linked to privately.
1890Kits have the following properties available (but only if kits are enabled):
1892 * `kit_modules`: Modules which are compiled into the kit.
1896@ingroup module-internal
1897@brief Set a module property
1899This function sets a [module property](@ref module-properties) on a module. The
1900required prefix will automatically be added to the passed name.
1903_vtk_module_set_module_property(<module>
1904 [APPEND] [APPEND_STRING]
1909function (_vtk_module_set_module_property module)
1910 cmake_parse_arguments(PARSE_ARGV 1 _vtk_property
1911 "APPEND;APPEND_STRING
"
1915 if (_vtk_property_UNPARSED_ARGUMENTS)
1917 "Unparsed arguments
for vtk_module_set_module_property:
"
1918 "${_vtk_property_UNPARSED_ARGUMENTS}.
")
1921 if (NOT DEFINED _vtk_property_PROPERTY)
1923 "The `PROPERTY` argument is required.
")
1926 if (NOT DEFINED _vtk_property_VALUE)
1928 "The `VALUE` argument is required.
")
1931 if (_vtk_property_APPEND AND _vtk_property_APPEND_STRING)
1933 "`APPEND` and `APPEND_STRING` may not be used at the same
time.
")
1936 set(_vtk_property_args)
1937 if (_vtk_property_APPEND)
1938 list(APPEND _vtk_property_args
1941 if (_vtk_property_APPEND_STRING)
1942 list(APPEND _vtk_property_args
1946 get_property(_vtk_property_is_alias
1948 PROPERTY ALIASED_TARGET
1950 if (_vtk_property_is_alias)
1951 _vtk_module_real_target(_vtk_property_target "${module}")
1953 set(_vtk_property_target "${module}")
1956 set_property(TARGET "${_vtk_property_target}"
1957 ${_vtk_property_args}
1959 "INTERFACE_vtk_module_${_vtk_property_PROPERTY}" "${_vtk_property_VALUE}")
1963@ingroup module-internal
1964@brief Get a module property
1966Get a [module property](@ref module-properties) from a module.
1969_vtk_module_get_module_property(<module>
1971 VARIABLE <variable>)
1974As with @ref vtk_module_get_property, the output variable will be unset if the
1975property is not set. The property name is automatically prepended with the
1978function (_vtk_module_get_module_property module)
1979 cmake_parse_arguments(PARSE_ARGV 1 _vtk_property
1984 if (_vtk_property_UNPARSED_ARGUMENTS)
1986 "Unparsed arguments
for vtk_module_get_module_property:
"
1987 "${_vtk_property_UNPARSED_ARGUMENTS}.
")
1990 if (NOT DEFINED _vtk_property_PROPERTY)
1992 "The `PROPERTY` argument is required.
")
1995 if (NOT DEFINED _vtk_property_VARIABLE)
1997 "The `VARIABLE` argument is required.
")
2000 get_property(_vtk_property_is_alias
2002 PROPERTY ALIASED_TARGET
2004 if (_vtk_property_is_alias)
2005 _vtk_module_real_target(_vtk_property_target "${module}")
2007 set(_vtk_property_target "${module}")
2010 get_property(_vtk_property_is_set
2011 TARGET "${_vtk_property_target}"
2012 PROPERTY "INTERFACE_vtk_module_${_vtk_property_PROPERTY}"
2014 if (_vtk_property_is_set)
2015 get_property(_vtk_property_value
2016 TARGET "${_vtk_property_target}"
2017 PROPERTY "INTERFACE_vtk_module_${_vtk_property_PROPERTY}")
2019 set("${_vtk_property_VARIABLE}"
2020 "${_vtk_property_value}"
2023 unset("${_vtk_property_VARIABLE}"
2029@ingroup module-internal
2030@brief Check that destinations are valid
2032All installation destinations are expected to be relative so that
2033`CMAKE_INSTALL_PREFIX` can be relied upon in all code paths. This function may
2034be used to verify that destinations are relative.
2037_vtk_module_check_destinations(<prefix> [<suffix>...])
2040For each `suffix`, `prefix` is prefixed to it and the resulting variable name
2041is checked for validity as an install prefix. Raises an error if any is
2044function (_vtk_module_check_destinations prefix)
2045 foreach (suffix IN LISTS ARGN)
2046 if (IS_ABSOLUTE "${${prefix}${suffix}}")
2048 "The `${suffix}` must not be an absolute path. Use "
2049 "`CMAKE_INSTALL_PREFIX` to keep everything in a single installation "
2056@ingroup module-internal
2057@brief Write an import prefix statement
2059CMake files, once installed, may need to construct paths to other locations
2060within the install prefix. This function writes a prefix computation for file
2061given its install destination.
2064_vtk_module_write_import_prefix(<file> <destination>)
2067The passed file is cleared so that it occurs at the top of the file. The prefix
2068is available in the file as the `_vtk_module_import_prefix` variable. It is
2069recommended to unset the variable at the end of the file.
2071function (_vtk_module_write_import_prefix file destination)
2072 if (IS_ABSOLUTE "${destination}")
2074 "An import prefix cannot be determined from an absolute installation "
2075 "destination. Use `CMAKE_INSTALL_PREFIX` to keep everything in a single "
2076 "installation prefix.")
2079 file(WRITE "${file}"
2080 "set(_vtk_module_import_prefix \"\${CMAKE_CURRENT_LIST_DIR}\")\n")
2082 get_filename_component(destination "${destination}" DIRECTORY)
2083 file(APPEND "${file}"
2084 "get_filename_component(_vtk_module_import_prefix \"\${_vtk_module_import_prefix}\" DIRECTORY)\n")
2089@ingroup module-internal
2090@brief Export properties on modules and targets
2092This function is intended for use in support functions which leverage the
2093module system, not by general system users. This function supports exporting
2094properties from the build into dependencies via target properties which are
2095loaded from a project's config file which is loaded via CMake's `find_package`
2099_vtk_module_export_properties(
2104 [PROPERTIES <property>...]
2105 [FROM_GLOBAL_PROPERTIES <property fragment>...]
2106 [SPLIT_INSTALL_PROPERTIES <property fragment>...])
2109The `BUILD_FILE` and `INSTALL_FILE` arguments are required. Exactly one of
2110`MODULE` and `KIT` is also required. The `MODULE` or `KIT` argument holds the
2111name of the module or kit that will have properties exported. The `BUILD_FILE`
2112and `INSTALL_FILE` paths are *appended to*. As such, when setting up these
2113files, it should be preceded with:
2116file(WRITE "${build_file}")
2117file(WRITE "${install_file}")
2120To avoid accidental usage of the install file from the build tree, it is
2121recommended to store it under a `CMakeFiles/` directory in the build tree with
2122an additional `.install` suffix and use `install(RENAME)` to rename it at
2125The set of properties exported is computed as follows:
2127 * `PROPERTIES` queries the module target for the given property and exports
2128 its value as-is to both the build and install files. In addition, these
2129 properties are set on the target directly as the same name.
2130 * `FROM_GLOBAL_PROPERTIES` queries the global
2131 `_vtk_module_<MODULE>_<fragment>` property and exports it to both the build
2132 and install files as `INTERFACE_vtk_module_<fragment>`.
2133 * `SPLIT_INSTALL_PROPERTIES` queries the target for
2134 `INTERFACE_vtk_module_<fragment>` and exports its value to the build file
2135 and `INTERFACE_vtk_module_<fragment>_install` to the install file as the
2136 non-install property name. This is generally useful for properties which
2137 change between the build and installation.
2139function (_vtk_module_export_properties)
2140 cmake_parse_arguments(PARSE_ARGV 0 _vtk_export_properties
2142 "BUILD_FILE;INSTALL_FILE;MODULE;KIT
"
2143 "FROM_GLOBAL_PROPERTIES;PROPERTIES;SPLIT_INSTALL_PROPERTIES
")
2145 if (_vtk_export_properties_UNPARSED_ARGUMENTS)
2147 "Unparsed arguments
for _vtk_export_properties:
"
2148 "${_vtk_export_properties_UNPARSED_ARGUMENTS}.
")
2151 if (DEFINED _vtk_export_properties_MODULE)
2152 if (DEFINED _vtk_export_properties_KIT)
2154 "Only one of `MODULE` or `KIT` is required to
export properties.
")
2156 set(_vtk_export_properties_type "module
")
2157 set(_vtk_export_properties_name "${_vtk_export_properties_MODULE}
")
2158 elseif (_vtk_export_properties_KIT)
2159 set(_vtk_export_properties_type "kit
")
2160 set(_vtk_export_properties_name "${_vtk_export_properties_KIT}
")
2163 "A module or kit is required to
export properties.
")
2166 if (NOT _vtk_export_properties_BUILD_FILE)
2168 "Exporting properties
requires a build file to write to.
")
2171 if (NOT _vtk_export_properties_INSTALL_FILE)
2173 "Exporting properties
requires an install file to write to.
")
2176 if (_vtk_export_properties_type STREQUAL "module
")
2177 _vtk_module_real_target(_vtk_export_properties_target_name "${_vtk_export_properties_name}
")
2178 elseif (_vtk_export_properties_type STREQUAL "kit
")
2179 _vtk_module_real_target_kit(_vtk_export_properties_target_name "${_vtk_export_properties_name}
")
2182 foreach (_vtk_export_properties_global IN LISTS _vtk_export_properties_FROM_GLOBAL_PROPERTIES)
2183 get_property(_vtk_export_properties_is_set GLOBAL
2184 PROPERTY "_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_name}_${_vtk_export_properties_global}
"
2186 if (NOT _vtk_export_properties_is_set)
2190 get_property(_vtk_export_properties_value GLOBAL
2191 PROPERTY "_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_name}_${_vtk_export_properties_global}
")
2192 set(_vtk_export_properties_set_property
2193 "set_property(TARGET \
"${_vtk_export_properties_name}\" PROPERTY \"INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_global}\" \"${_vtk_export_properties_value}\")\n")
2195 set_property(TARGET
"${_vtk_export_properties_target_name}"
2197 "INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_global}" "${_vtk_export_properties_value}")
2198 file(APPEND
"${_vtk_export_properties_BUILD_FILE}"
2199 "${_vtk_export_properties_set_property}")
2200 file(APPEND
"${_vtk_export_properties_INSTALL_FILE}"
2201 "${_vtk_export_properties_set_property}")
2204 foreach (_vtk_export_properties_target IN LISTS _vtk_export_properties_PROPERTIES)
2205 get_property(_vtk_export_properties_is_set
2206 TARGET
"${_vtk_export_properties_target_name}"
2207 PROPERTY
"${_vtk_export_properties_target}"
2209 if (NOT _vtk_export_properties_is_set)
2213 get_property(_vtk_export_properties_value
2214 TARGET
"${_vtk_export_properties_target_name}"
2215 PROPERTY
"${_vtk_export_properties_target}")
2216 set(_vtk_export_properties_set_property
2217 "set_property(TARGET \"${_vtk_export_properties_name}\" PROPERTY \"${_vtk_export_properties_target}\" \"${_vtk_export_properties_value}\")\n")
2219 file(APPEND
"${_vtk_export_properties_BUILD_FILE}"
2220 "${_vtk_export_properties_set_property}")
2221 file(APPEND
"${_vtk_export_properties_INSTALL_FILE}"
2222 "${_vtk_export_properties_set_property}")
2225 foreach (_vtk_export_properties_split IN LISTS _vtk_export_properties_SPLIT_INSTALL_PROPERTIES)
2226 get_property(_vtk_export_properties_is_set
2227 TARGET
"${_vtk_export_properties_target_name}"
2228 PROPERTY
"INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_split}"
2230 if (NOT _vtk_export_properties_is_set)
2234 get_property(_vtk_export_properties_value
2235 TARGET
"${_vtk_export_properties_target_name}"
2236 PROPERTY
"INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_split}")
2237 set(_vtk_export_properties_set_property
2238 "set_property(TARGET \"${_vtk_export_properties_name}\" PROPERTY \"INTERFACE_vtk_module_${_vtk_export_properties_split}\" \"${_vtk_export_properties_value}\")\n")
2239 file(APPEND
"${_vtk_export_properties_BUILD_FILE}"
2240 "${_vtk_export_properties_set_property}")
2242 get_property(_vtk_export_properties_value
2243 TARGET
"${_vtk_export_properties_target_name}"
2244 PROPERTY
"INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_split}_install")
2245 set(_vtk_export_properties_set_property
2246 "set_property(TARGET \"${_vtk_export_properties_name}\" PROPERTY \"INTERFACE_vtk_module_${_vtk_export_properties_split}\" \"${_vtk_export_properties_value}\")\n")
2247 file(APPEND
"${_vtk_export_properties_INSTALL_FILE}"
2248 "${_vtk_export_properties_set_property}")
2252include(
"${CMAKE_CURRENT_LIST_DIR}/vtkModuleTesting.cmake")
2256@brief Build modules and kits
2258Once all of the modules have been scanned, they need to be built. Generally,
2259there will be just one build necessary
for a set of scans, though they may be
2260built distinctly as well. If there are multiple calls to
this function, they
2261should generally in reverse
order of their scans.
2268 [LIBRARY_NAME_SUFFIX <suffix>]
2270 [SOVERSION <soversion>]
2274 [BUILD_WITH_KITS <ON|OFF>]
2276 [ENABLE_WRAPPING <ON|OFF>]
2278 [USE_EXTERNAL <ON|OFF>]
2280 [INSTALL_HEADERS <ON|OFF>]
2281 [HEADERS_COMPONENT <component>]
2283 [TARGETS_COMPONENT <component>]
2284 [INSTALL_EXPORT <export>]
2286 [TARGET_SPECIFIC_COMPONENTS <ON|OFF>]
2288 [LICENSE_COMPONENT <component>]
2290 [UTILITY_TARGET <target>]
2292 [TEST_DIRECTORY_NAME <name>]
2293 [TEST_DATA_TARGET <target>]
2294 [TEST_INPUT_DATA_DIRECTORY <directory>]
2295 [TEST_OUTPUT_DATA_DIRECTORY <directory>]
2296 [TEST_OUTPUT_DIRECTORY <directory>]
2298 [ARCHIVE_DESTINATION <destination>]
2299 [HEADERS_DESTINATION <destination>]
2300 [LIBRARY_DESTINATION <destination>]
2301 [RUNTIME_DESTINATION <destination>]
2302 [CMAKE_DESTINATION <destination>]
2303 [LICENSE_DESTINATION <destination>]
2304 [HIERARCHY_DESTINATION <destination>])
2307The only requirement of the
function is the list of modules to build, the rest
2308have reasonable defaults
if not specified.
2310 * `MODULES`: (Required) The list of modules to build.
2311 * `KITS`: (Required if `BUILD_WITH_KITS` is `ON`) The list of kits to build.
2312 * `LIBRARY_NAME_SUFFIX`: (Defaults to `
""`) A suffix to add to library names.
2313 If it is not empty, it is prefixed with `-` to separate it from the kit
2315 * `VERSION`: If specified, the `VERSION` property
on built libraries will be
2317 * `SOVERSION`: If specified, the `SOVERSION` property
on built libraries will
2318 be set to this
value.
2319 * `PACKAGE`: (Defaults to `${CMAKE_PROJECT_NAME}`) The
name the build is
2320 meant to be found as when using `find_package`. Note that separate builds
2321 will require distinct `PACKAGE` values.
2322 * `BUILD_WITH_KITS`: (Defaults to `OFF`) If
enabled, kit libraries will be
2324 * `ENABLE_WRAPPING`: (Default depends
on the existence of
2325 `VTK::WrapHierarchy` or `VTKCompileTools::WrapHierarchy` targets) If
2326 enabled, wrapping will be available to the modules built in this call.
2327 * `USE_EXTERNAL`: (Defaults to `OFF`) Whether third party modules should find
2328 external copies rather than building their own copy.
2329 * `INSTALL_HEADERS`: (Defaults to `ON`) Whether or not to install public headers.
2330 * `HEADERS_COMPONENT`: (Defaults to `development`) The install
component to
2331 use for header installation. Note that other SDK-related bits use the same
2333 * `TARGETS_COMPONENT`: `Defaults to `runtime`) The install
component to use
2334 for the libraries built.
2335 * `TARGET_SPECIFIC_COMPONENTS`: (Defaults to `OFF`) If `ON`, place artifacts
2336 into
target-specific install components (`<TARGET>-<COMPONENT>`).
2337 * `LICENSE_COMPONENT`: (Defaults to `licenses`) The install
component to use
2339 * `UTILITY_TARGET`: If specified, all libraries and executables made by the
2340 VTK Module API will privately link to this
target. This may be used to
2341 provide things such as project-wide compilation flags or similar.
2342 * `TARGET_NAMESPACE`: `Defaults to `\<AUTO\>`) The namespace for installed
2343 targets. All targets must have the same namespace. If set to `\<AUTO\>`,
2344 the namespace will be detected automatically.
2345 * `INSTALL_EXPORT`: (Defaults to `
""`) If non-empty, targets will be added to
2346 the given export. The export will also be installed as part of this build
2348 * `TEST_DIRECTORY_NAME`: (Defaults to `Testing`) The
name of the testing
2349 directory to look for in each module. Set to `NONE` to disable automatic
2351 * `TEST_DATA_TARGET`: (Defaults to `<PACKAGE>-
data`) The
target to add
2352 testing
data download commands to.
2353 * `TEST_INPUT_DATA_DIRECTORY`: (Defaults to
2354 `${CMAKE_CURRENT_SOURCE_DIR}/Data`) The directory which will contain
data
2356 * `TEST_OUTPUT_DATA_DIRECTORY`: (Defaults to
2357 `${CMAKE_CURRENT_BINARY_DIR}/Data`) The directory which will contain
data
2359 * `TEST_OUTPUT_DIRECTORY`: (Defaults to
2360 `${CMAKE_BINARY_DIR}/<TEST_DIRECTORY_NAME>/Temporary`) The directory which
2361 tests may write any output files to.
2363The remaining arguments control where to install files related to the build.
2364See CMake
documentation for the difference between `ARCHIVE`, `LIBRARY`, and
2367 * `ARCHIVE_DESTINATION`: (Defaults to `${CMAKE_INSTALL_LIBDIR}`) The install
2368 destination for archive files.
2369 * `HEADERS_DESTINATION`: (Defaults to `${CMAKE_INSTALL_INCLUDEDIR}`) The
2370 install destination for header files.
2371 * `LIBRARY_DESTINATION`: (Defaults to `${CMAKE_INSTALL_LIBDIR}`) The install
2372 destination for library files.
2373 * `RUNTIME_DESTINATION`: (Defaults to `${CMAKE_INSTALL_BINDIR}`) The install
2374 destination for runtime files.
2375 * `CMAKE_DESTINATION`: (Defaults to `<LIBRARY_DESTINATION>/cmake/<PACKAGE>`)
2376 The install destination for CMake files.
2377 * `LICENSE_DESTINATION`: (Defaults to `${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}`)
2378 The install destination for license files.
2379 * `HIERARCHY_DESTINATION`: (Defaults to
2380 `<LIBRARY_DESTINATION>/
vtk/hierarchy/<PACKAGE>`) The install destination
2381 for hierarchy files (used for
language wrapping).
2384 set(_vtk_build_install_arguments
2403 HIERARCHY_DESTINATION)
2404 set(_vtk_build_test_arguments
2408 TEST_INPUT_DATA_DIRECTORY
2409 TEST_OUTPUT_DATA_DIRECTORY
2410 TEST_OUTPUT_DIRECTORY)
2412 # TODO: Add an option to build statically? Currently, `BUILD_SHARED_LIBS` is
2415 cmake_parse_arguments(PARSE_ARGV 0 _vtk_build
2417 "BUILD_WITH_KITS;USE_EXTERNAL;TARGET_SPECIFIC_COMPONENTS;LIBRARY_NAME_SUFFIX;VERSION;SOVERSION;PACKAGE;ENABLE_WRAPPING;${_vtk_build_install_arguments};${_vtk_build_test_arguments}"
2420 if (_vtk_build_UNPARSED_ARGUMENTS)
2422 "Unparsed arguments for vtk_module_build: "
2423 "${_vtk_build_UNPARSED_ARGUMENTS}")
2426 if (NOT DEFINED _vtk_build_USE_EXTERNAL)
2427 set(_vtk_build_USE_EXTERNAL OFF)
2430 if (NOT DEFINED _vtk_build_TARGET_SPECIFIC_COMPONENTS)
2431 set(_vtk_build_TARGET_SPECIFIC_COMPONENTS OFF)
2434 if (NOT DEFINED _vtk_build_PACKAGE)
2435 set(_vtk_build_PACKAGE
"${CMAKE_PROJECT_NAME}")
2437 get_property(_vtk_build_package_exists GLOBAL
2438 PROPERTY
"_vtk_module_package_${_vtk_build_PACKAGE}"
2440 if (_vtk_build_package_exists)
2442 "A set of modules have already been built using the "
2443 "`${_vtk_build_PACKAGE}` package.")
2447 "_vtk_module_package_${_vtk_build_PACKAGE}" "ON")
2450 if (NOT DEFINED _vtk_build_INSTALL_HEADERS)
2451 set(_vtk_build_INSTALL_HEADERS ON)
2454 if (NOT DEFINED _vtk_build_ENABLE_WRAPPING)
2455 if (TARGET
"VTKCompileTools::WrapHierarchy" OR
2456 TARGET
"VTK::WrapHierarchy")
2457 set(_vtk_build_ENABLE_WRAPPING ON)
2459 set(_vtk_build_ENABLE_WRAPPING OFF)
2463 if (NOT DEFINED _vtk_build_TARGET_NAMESPACE)
2464 set(_vtk_build_TARGET_NAMESPACE
"<AUTO>")
2467 if (NOT DEFINED _vtk_build_BUILD_WITH_KITS)
2468 set(_vtk_build_BUILD_WITH_KITS OFF)
2470 if (_vtk_build_BUILD_WITH_KITS AND NOT BUILD_SHARED_LIBS)
2471 message(AUTHOR_WARNING
2472 "Static builds with kits are not well-tested and doesn't make much "
2473 "sense. It is recommended to only build with kits in shared builds.")
2476 if (_vtk_build_BUILD_WITH_KITS AND NOT DEFINED _vtk_build_KITS)
2478 "Building with kits was requested, but no kits were specified.")
2481 if (NOT DEFINED _vtk_build_TEST_DIRECTORY_NAME)
2482 set(_vtk_build_TEST_DIRECTORY_NAME
"Testing")
2485 if (NOT DEFINED _vtk_build_TEST_DATA_TARGET)
2486 set(_vtk_build_TEST_DATA_TARGET
"${_vtk_build_PACKAGE}-data")
2489 if (NOT DEFINED _vtk_build_TEST_INPUT_DATA_DIRECTORY)
2490 set(_vtk_build_TEST_INPUT_DATA_DIRECTORY
"${CMAKE_CURRENT_SOURCE_DIR}/Data")
2493 if (NOT DEFINED _vtk_build_TEST_OUTPUT_DATA_DIRECTORY)
2494 set(_vtk_build_TEST_OUTPUT_DATA_DIRECTORY
"${CMAKE_CURRENT_BINARY_DIR}/Data")
2497 if (NOT DEFINED _vtk_build_TEST_OUTPUT_DIRECTORY)
2498 set(_vtk_build_TEST_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${_vtk_build_TEST_DIRECTORY_NAME}/Temporary")
2501 if (NOT DEFINED _vtk_build_HEADERS_COMPONENT)
2502 set(_vtk_build_HEADERS_COMPONENT
"development")
2505 if (NOT DEFINED _vtk_build_LICENSE_COMPONENT)
2506 set(_vtk_build_LICENSE_COMPONENT
"licenses")
2509 if (NOT DEFINED _vtk_build_ARCHIVE_DESTINATION)
2510 set(_vtk_build_ARCHIVE_DESTINATION
"${CMAKE_INSTALL_LIBDIR}")
2513 if (NOT DEFINED _vtk_build_HEADERS_DESTINATION)
2514 set(_vtk_build_HEADERS_DESTINATION
"${CMAKE_INSTALL_INCLUDEDIR}")
2517 if (NOT DEFINED _vtk_build_LIBRARY_DESTINATION)
2518 set(_vtk_build_LIBRARY_DESTINATION
"${CMAKE_INSTALL_LIBDIR}")
2521 if (NOT DEFINED _vtk_build_RUNTIME_DESTINATION)
2522 set(_vtk_build_RUNTIME_DESTINATION
"${CMAKE_INSTALL_BINDIR}")
2525 if (NOT DEFINED _vtk_build_CMAKE_DESTINATION)
2526 set(_vtk_build_CMAKE_DESTINATION
"${_vtk_build_LIBRARY_DESTINATION}/cmake/${_vtk_build_PACKAGE}")
2529 if (NOT DEFINED _vtk_build_LICENSE_DESTINATION)
2530 set(_vtk_build_LICENSE_DESTINATION
"${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}")
2533 if (NOT DEFINED _vtk_build_HIERARCHY_DESTINATION)
2534 set(_vtk_build_HIERARCHY_DESTINATION
"${_vtk_build_LIBRARY_DESTINATION}/vtk/hierarchy/${_vtk_build_PACKAGE}")
2537 if (NOT DEFINED _vtk_build_TARGETS_COMPONENT)
2538 set(_vtk_build_TARGETS_COMPONENT
"runtime")
2541 if (NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
2542 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${_vtk_build_ARCHIVE_DESTINATION}")
2544 if (NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
2545 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${_vtk_build_LIBRARY_DESTINATION}")
2547 if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
2548 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${_vtk_build_RUNTIME_DESTINATION}")
2551 if (NOT _vtk_build_MODULES)
2553 "No modules given to build.")
2562 HIERARCHY_DESTINATION)
2564 foreach (_vtk_build_module IN LISTS _vtk_build_MODULES)
2565 get_property(
"_vtk_build_${_vtk_build_module}_depends" GLOBAL
2566 PROPERTY
"_vtk_module_${_vtk_build_module}_depends")
2567 get_property(
"_vtk_build_${_vtk_build_module}_private_depends" GLOBAL
2568 PROPERTY
"_vtk_module_${_vtk_build_module}_private_depends")
2569 get_property(
"_vtk_build_${_vtk_build_module}_optional_depends" GLOBAL
2570 PROPERTY
"_vtk_module_${_vtk_build_module}_optional_depends")
2571 get_property(
"_vtk_build_${_vtk_build_module}_order_depends" GLOBAL
2572 PROPERTY
"_vtk_module_${_vtk_build_module}_order_depends")
2573 set(
"_vtk_build_${_vtk_build_module}_all_depends"
2574 ${_vtk_build_${_vtk_build_module}_depends}
2575 ${_vtk_build_${_vtk_build_module}_private_depends}
2576 ${_vtk_build_${_vtk_build_module}_optional_depends}
2577 ${_vtk_build_${_vtk_build_module}_order_depends})
2580 set(_vtk_build_sorted_modules
"${_vtk_build_MODULES}")
2581 vtk_topological_sort(_vtk_build_sorted_modules
"_vtk_build_" "_all_depends")
2583 foreach (_vtk_build_module IN LISTS _vtk_build_sorted_modules)
2584 if (NOT _vtk_build_module IN_LIST _vtk_build_MODULES)
2588 if (TARGET
"${_vtk_build_module}")
2589 get_property(_vtk_build_is_imported
2590 TARGET
"${_vtk_build_module}"
2593 # TODO: Is this right?
2594 if (NOT _vtk_build_is_imported)
2596 "The ${_vtk_build_module} module has been requested to be built, but "
2597 "it is already built by this project.")
2603 foreach (_vtk_build_depend IN LISTS
"_vtk_build_${_vtk_build_module}_depends" "_vtk_build_${_vtk_build_module}_private_depends")
2604 if (NOT TARGET
"${_vtk_build_depend}")
2605 get_property(_vtk_build_enable_tests_by_want GLOBAL
2606 PROPERTY
"_vtk_module_${_vtk_build_module}_enable_tests_by_want")
2608 set(_vtk_build_explain
"")
2609 if (_vtk_build_enable_tests_by_want)
2610 string(APPEND _vtk_build_explain
2611 " The `vtk_module_scan` for this module used `ENABLE_TESTS WANT`. "
2612 "This is a known issue, but the fix is not trivial. You may "
2613 "either change the flag used to control testing for this scan or "
2614 "explicitly enable the ${_vtk_build_depend} module.")
2618 "The ${_vtk_build_depend} dependency is missing for "
2619 "${_vtk_build_module}.${_vtk_build_explain}")
2623 get_property(_vtk_build_module_file GLOBAL
2624 PROPERTY
"_vtk_module_${_vtk_build_module}_file")
2625 if (NOT _vtk_build_module_file)
2627 "The requested ${_vtk_build_module} module is not a VTK module.")
2632 get_filename_component(_vtk_build_module_dir
"${_vtk_build_module_file}" DIRECTORY)
2633 if (COMMAND cmake_path) # XXX(cmake-3.20)
2634 cmake_path(NORMAL_PATH _vtk_build_module_dir)
2636 get_filename_component(_vtk_build_module_dir
"${_vtk_build_module_dir}" ABSOLUTE)
2638 file(RELATIVE_PATH _vtk_build_module_subdir
"${CMAKE_SOURCE_DIR}" "${_vtk_build_module_dir}")
2639 set(_vtk_build_module_subdir_build
"${_vtk_build_module_subdir}")
2641 # Check if the
source for this module is outside of `CMAKE_SOURCE_DIR`.
2642 # Place it under `CMAKE_BINARY_DIR` more meaningfully if so.
2643 if (_vtk_build_module_subdir MATCHES
"\\.\\./")
2644 file(RELATIVE_PATH _vtk_build_module_subdir_build
"${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")
2645 get_property(_vtk_build_module_library_name GLOBAL
2646 PROPERTY
"_vtk_module_${_vtk_build_module}_library_name")
2647 string(APPEND _vtk_build_module_subdir_build
"/${_vtk_build_module_library_name}")
2651 "${CMAKE_SOURCE_DIR}/${_vtk_build_module_subdir}"
2652 "${CMAKE_BINARY_DIR}/${_vtk_build_module_subdir_build}")
2654 if (NOT TARGET
"${_vtk_build_module}")
2656 "The ${_vtk_build_module} is being built, but a matching target was "
2661 if (_vtk_build_BUILD_WITH_KITS)
2662 foreach (_vtk_build_kit IN LISTS _vtk_build_KITS)
2663 get_property(_vtk_build_target_name GLOBAL
2664 PROPERTY
"_vtk_kit_${_vtk_build_kit}_target_name")
2665 set(_vtk_kit_source_file
2666 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/vtk_module_kit_${_vtk_build_target_name}.c")
2668 OUTPUT
"${_vtk_kit_source_file}"
2669 CONTENT
"void vtk_module_kit_${_vtk_build_target_name}() {}\n")
2670 add_library(
"${_vtk_build_target_name}"
2671 "${_vtk_kit_source_file}")
2672 get_property(_vtk_build_namespace GLOBAL
2673 PROPERTY
"_vtk_kit_${_vtk_build_kit}_namespace")
2674 if (_vtk_build_TARGET_NAMESPACE STREQUAL
"<AUTO>")
2675 set(_vtk_build_TARGET_NAMESPACE
"${_vtk_build_namespace}")
2677 if (NOT _vtk_build_namespace STREQUAL _vtk_build_TARGET_NAMESPACE)
2679 "The `TARGET_NAMESPACE` (${_vtk_build_TARGET_NAMESPACE}) is not the "
2680 "same as the ${_vtk_build_kit} kit namespace "
2681 "(${_vtk_build_namespace}).")
2683 if (NOT _vtk_build_kit STREQUAL _vtk_build_target_name)
2684 add_library(
"${_vtk_build_kit}" ALIAS
2685 "${_vtk_build_target_name}")
2690 set(_vtk_build_kit_modules_object_libraries)
2691 set(_vtk_build_kit_modules_private_depends)
2693 get_property(_vtk_build_kit_modules GLOBAL
2694 PROPERTY
"_vtk_kit_${_vtk_build_kit}_kit_modules")
2695 foreach (_vtk_build_kit_module IN LISTS _vtk_build_kit_modules)
2696 get_property(_vtk_build_kit_module_target_name GLOBAL
2697 PROPERTY
"_vtk_module_${_vtk_build_kit_module}_target_name")
2698 list(APPEND _vtk_build_kit_modules_object_libraries
2699 "${_vtk_build_kit_module_target_name}-objects")
2702 USAGE_TARGET_NAME _vtk_build_kit_module_usage_name)
2703 if (TARGET
"${_vtk_build_kit_module_usage_name}")
2704 list(APPEND _vtk_build_kit_modules_private_depends
2705 "${_vtk_build_kit_module_usage_name}")
2708 # Since there is no link step for modules, we need to copy the private
2709 # dependencies of the constituent modules into the kit so that their
2710 # private dependencies are actually linked.
2711 get_property(_vtk_build_kit_module_private_depends GLOBAL
2712 PROPERTY
"_vtk_module_${_vtk_build_kit_module}_private_depends")
2713 # Also grab optional dependencies since they end up being private
2715 get_property(_vtk_build_kit_module_optional_depends GLOBAL
2716 PROPERTY
"_vtk_module_${_vtk_build_kit_module}_optional_depends")
2717 foreach (_vtk_build_kit_module_private_depend IN LISTS _vtk_build_kit_module_private_depends _vtk_build_kit_module_optional_depends)
2718 if (NOT TARGET
"${_vtk_build_kit_module_private_depend}")
2722 # But we don
't need to link to modules that are part of the kit we are
2724 if (NOT _vtk_build_kit_module_private_depend IN_LIST _vtk_build_kit_modules)
2725 list(APPEND _vtk_build_kit_modules_private_depends
2726 "$<LINK_ONLY:${_vtk_build_kit_module_private_depend}>")
2731 if (_vtk_build_kit_modules_private_depends)
2732 list(REMOVE_DUPLICATES _vtk_build_kit_modules_private_depends)
2734 if (_vtk_build_kit_modules_private_links)
2735 list(REMOVE_DUPLICATES _vtk_build_kit_modules_private_links)
2738 target_link_libraries("${_vtk_build_target_name}"
2740 ${_vtk_build_kit_modules_object_libraries}
2741 ${_vtk_build_kit_modules_private_depends})
2743 if (_vtk_build_UTILITY_TARGET)
2744 target_link_libraries("${_vtk_build_target_name}"
2746 "${_vtk_build_UTILITY_TARGET}")
2749 get_property(_vtk_build_kit_library_name GLOBAL
2750 PROPERTY "_vtk_kit_${_vtk_build_kit}_library_name")
2751 if (_vtk_build_LIBRARY_NAME_SUFFIX)
2752 string(APPEND _vtk_build_kit_library_name "-${_vtk_build_LIBRARY_NAME_SUFFIX}")
2754 set_target_properties("${_vtk_build_target_name}"
2756 OUTPUT_NAME "${_vtk_build_kit_library_name}")
2760 set(_vtk_build_properties_filename "${_vtk_build_PACKAGE}-vtk-module-properties.cmake")
2761 set(_vtk_build_properties_install_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_build_properties_filename}.install")
2762 set(_vtk_build_properties_build_file "${CMAKE_BINARY_DIR}/${_vtk_build_CMAKE_DESTINATION}/${_vtk_build_properties_filename}")
2764 file(WRITE "${_vtk_build_properties_build_file}")
2766 _vtk_module_write_import_prefix(
2767 "${_vtk_build_properties_install_file}"
2768 "${_vtk_build_CMAKE_DESTINATION}")
2770 foreach (_vtk_build_module IN LISTS _vtk_build_MODULES)
2771 get_property(_vtk_build_namespace GLOBAL
2772 PROPERTY "_vtk_module_${_vtk_build_module}_namespace")
2773 if (_vtk_build_TARGET_NAMESPACE STREQUAL "<AUTO>")
2774 set(_vtk_build_TARGET_NAMESPACE "${_vtk_build_namespace}")
2776 if (NOT _vtk_build_namespace STREQUAL _vtk_build_TARGET_NAMESPACE)
2778 "The `TARGET_NAMESPACE` (${_vtk_build_TARGET_NAMESPACE}) is not the "
2779 "same as the ${_vtk_build_module} module namespace "
2780 "(${_vtk_build_namespace}).")
2783 get_property(_vtk_build_is_third_party
2784 TARGET "${_vtk_build_module}"
2785 PROPERTY "INTERFACE_vtk_module_third_party")
2786 if (_vtk_build_is_third_party)
2787 _vtk_module_export_properties(
2788 BUILD_FILE "${_vtk_build_properties_build_file}"
2789 INSTALL_FILE "${_vtk_build_properties_install_file}"
2790 MODULE "${_vtk_build_module}"
2791 FROM_GLOBAL_PROPERTIES
2792 # Export the dependencies of a module.
2796 # The library name of the module.
2799 # Export whether a module is third party or not.
2800 INTERFACE_vtk_module_third_party
2801 INTERFACE_vtk_module_exclude_wrap)
2805 set(_vtk_build_split_properties)
2806 get_property(_vtk_build_exclude_wrap
2807 TARGET "${_vtk_build_module}"
2808 PROPERTY "INTERFACE_vtk_module_${_vtk_build_module}_exclude_wrap")
2809 if (NOT _vtk_build_exclude_wrap)
2810 list(APPEND _vtk_build_split_properties
2812 if (_vtk_build_ENABLE_WRAPPING)
2813 list(APPEND _vtk_build_split_properties
2818 set(_vtk_build_properties_kit_properties)
2819 if (_vtk_build_BUILD_WITH_KITS)
2820 list(APPEND _vtk_build_properties_kit_properties
2821 # Export the kit membership of a module.
2825 _vtk_module_export_properties(
2826 BUILD_FILE "${_vtk_build_properties_build_file}"
2827 INSTALL_FILE "${_vtk_build_properties_install_file}"
2828 MODULE "${_vtk_build_module}"
2829 FROM_GLOBAL_PROPERTIES
2830 # Export whether the module should be excluded from wrapping or not.
2832 # Export the dependencies of a module.
2836 # Export what modules are implemented by the module.
2838 # Export whether the module contains autoinit logic.
2840 # The library name of the module.
2842 ${_vtk_build_properties_kit_properties}
2844 # Export whether the module needs autoinit logic handled.
2845 INTERFACE_vtk_module_needs_autoinit
2846 # Forward private usage requirements with global effects.
2847 INTERFACE_vtk_module_forward_link
2848 SPLIT_INSTALL_PROPERTIES
2849 # Set the properties which differ between build and install trees.
2850 ${_vtk_build_split_properties})
2853 if (_vtk_build_BUILD_WITH_KITS)
2854 foreach (_vtk_build_kit IN LISTS _vtk_build_KITS)
2855 _vtk_module_export_properties(
2856 BUILD_FILE "${_vtk_build_properties_build_file}"
2857 INSTALL_FILE "${_vtk_build_properties_install_file}"
2858 KIT "${_vtk_build_kit}"
2859 FROM_GLOBAL_PROPERTIES
2860 # Export the list of modules in the kit.
2865 if (_vtk_build_INSTALL_EXPORT AND _vtk_build_INSTALL_HEADERS)
2866 set(_vtk_build_namespace)
2867 if (_vtk_build_TARGET_NAMESPACE)
2868 set(_vtk_build_namespace
2869 NAMESPACE "${_vtk_build_TARGET_NAMESPACE}::")
2873 EXPORT "${_vtk_build_INSTALL_EXPORT}"
2874 ${_vtk_build_namespace}
2875 FILE "${CMAKE_BINARY_DIR}/${_vtk_build_CMAKE_DESTINATION}/${_vtk_build_PACKAGE}-targets.cmake")
2877 EXPORT "${_vtk_build_INSTALL_EXPORT}"
2878 DESTINATION "${_vtk_build_CMAKE_DESTINATION}"
2879 ${_vtk_build_namespace}
2880 FILE "${_vtk_build_PACKAGE}-targets.cmake"
2881 COMPONENT "${_vtk_build_HEADERS_COMPONENT}")
2883 if (_vtk_build_INSTALL_HEADERS)
2884 file(APPEND "${_vtk_build_properties_install_file}"
2885 "unset(_vtk_module_import_prefix)\n")
2888 FILES "${_vtk_build_properties_install_file}"
2889 DESTINATION "${_vtk_build_CMAKE_DESTINATION}"
2890 RENAME "${_vtk_build_properties_filename}"
2891 COMPONENT "${_vtk_build_HEADERS_COMPONENT}")
2895 get_property(_vtk_build_test_modules GLOBAL
2896 PROPERTY "_vtk_module_test_modules")
2897 set(_vtk_build_tests_handled)
2898 foreach (_vtk_build_test IN LISTS _vtk_build_test_modules)
2899 if (NOT _vtk_build_test IN_LIST _vtk_build_MODULES)
2902 list(APPEND _vtk_build_tests_handled
2903 "${_vtk_build_test}")
2905 get_property(_vtk_build_test_depends GLOBAL
2906 PROPERTY "_vtk_module_${_vtk_build_test}_test_depends")
2908 set(_vtk_build_test_has_depends TRUE)
2909 foreach (_vtk_build_test_depend IN LISTS _vtk_build_test_depends)
2910 if (NOT TARGET "${_vtk_build_test_depend}")
2911 set(_vtk_build_test_has_depends FALSE)
2912 _vtk_module_debug(testing "@_vtk_build_test@ testing disabled due to missing @_vtk_build_test_depend@")
2915 if (NOT _vtk_build_test_has_depends)
2919 get_property(_vtk_build_module_file GLOBAL
2920 PROPERTY "_vtk_module_${_vtk_build_test}_file")
2922 if (NOT _vtk_build_TEST_DIRECTORY_NAME STREQUAL "NONE")
2923 get_filename_component(_vtk_build_module_dir "${_vtk_build_module_file}" DIRECTORY)
2924 if (COMMAND cmake_path) # XXX(cmake-3.20)
2925 cmake_path(NORMAL_PATH _vtk_build_module_dir)
2927 get_filename_component(_vtk_build_module_dir "${_vtk_build_module_dir}" ABSOLUTE)
2929 file(RELATIVE_PATH _vtk_build_module_subdir "${CMAKE_SOURCE_DIR}" "${_vtk_build_module_dir}")
2930 set(_vtk_build_module_subdir_build "${_vtk_build_module_subdir}")
2931 if (EXISTS "${CMAKE_SOURCE_DIR}/${_vtk_build_module_subdir}/${_vtk_build_TEST_DIRECTORY_NAME}")
2932 # Check if the source for this module is outside of `CMAKE_SOURCE_DIR`.
2933 # Place it under `CMAKE_BINARY_DIR` more meaningfully if so.
2934 if (_vtk_build_module_subdir MATCHES "\\.\\./")
2935 file(RELATIVE_PATH _vtk_build_module_subdir_build "${CMAKE_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")
2936 get_property(_vtk_build_module_library_name GLOBAL
2937 PROPERTY "_vtk_module_${_vtk_build_test}_library_name")
2938 string(APPEND _vtk_build_module_subdir_build "/${_vtk_build_module_library_name}")
2941 get_property(_vtk_build_test_labels GLOBAL
2942 PROPERTY "_vtk_module_${_vtk_build_test}_test_labels")
2944 "${CMAKE_SOURCE_DIR}/${_vtk_build_module_subdir}/${_vtk_build_TEST_DIRECTORY_NAME}"
2945 "${CMAKE_BINARY_DIR}/${_vtk_build_module_subdir_build}/${_vtk_build_TEST_DIRECTORY_NAME}")
2950 if (_vtk_build_test_modules AND _vtk_build_tests_handled)
2951 list(REMOVE_ITEM _vtk_build_test_modules
2952 ${_vtk_build_tests_handled})
2955 _vtk_module_test_modules "${_vtk_build_test_modules}")
2961@brief Add "standard" include directories to a module
2963Add the "standard" includes for a module to its interface. These are the source
2964and build directories for the module itself. They are always either `PUBLIC` or
2965`INTERFACE` (depending on the module's
target type).
2972 [HEADERS_DESTINATION <destination>])
2976 cmake_parse_arguments(PARSE_ARGV 0 _vtk_standard_includes
2978 "TARGET;HEADERS_DESTINATION"
2981 if (NOT _vtk_standard_includes_TARGET)
2983 "The `TARGET` argument is required.")
2985 if (NOT TARGET
"${_vtk_standard_includes_TARGET}")
2987 "The `TARGET` argument is not a target.")
2990 if (_vtk_standard_includes_UNPARSED_ARGUMENTS)
2992 "Unparsed arguments for vtk_module_standard_includes: "
2993 "${_vtk_standard_includes_UNPARSED_ARGUMENTS}")
2996 set(_vtk_standard_includes_system)
2997 if (_vtk_standard_includes_SYSTEM)
2998 set(_vtk_standard_includes_system SYSTEM)
3001 set(_vtk_standard_includes_visibility PUBLIC)
3002 if (_vtk_standard_includes_INTERFACE)
3003 set(_vtk_standard_includes_visibility INTERFACE)
3006 target_include_directories(
"${_vtk_standard_includes_TARGET}"
3007 ${_vtk_standard_includes_system}
3008 "${_vtk_standard_includes_visibility}"
3009 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
3010 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
3012 if (_vtk_build_INSTALL_HEADERS AND _vtk_standard_includes_HEADERS_DESTINATION)
3013 target_include_directories(
"${_vtk_standard_includes_TARGET}"
3014 ${_vtk_standard_includes_system}
3015 "${_vtk_standard_includes_visibility}"
3016 $<INSTALL_INTERFACE:${_vtk_standard_includes_HEADERS_DESTINATION}>)
3022@brief Determine the default export macro for a module
3024Determines the export macro to be used for a module from its metadata. Assumes
3028_vtk_module_default_library_name(<varname>)
3032 get_property(_vtk_module_default_library_name GLOBAL
3033 PROPERTY
"_vtk_module_${_vtk_build_module}_library_name")
3034 string(TOUPPER
"${_vtk_module_default_library_name}" _vtk_default_export_macro_upper)
3036 "${_vtk_default_export_macro_upper}"
3040# TODO: It would be nice to support `USE_LINK_PROPERTIES` instead of listing
3041# the modules again here. However, the format of the `LINK_LIBRARIES` property
3042# value may not be easy to handle.
3045@page module-overview
3048@section module-autoinit Autoinit
3050When a module contains a factory which may be populated by other modules, these
3051factories need to be populated when the modules are loaded by the dynamic linker
3052(for shared builds) or program
load time (for static builds). To provide for
3053this, the module system contains an autoinit
"subsystem".
3055@subsection module-autoinit-leverage Leveraging the autoinit subsystem
3057The subsystem provides the following hooks for use by projects:
3059 * In modules which `IMPLEMENTS` other modules, in the generated
3060 `<module>Module.
h` header (which provides export symbols as well) will
3061 include the modules which are implemented.
3062 * In modules which are `IMPLEMENTABLE` or `IMPLEMENTS` another module, the
3063 generated `<module>Module.
h` file will include the following block:
3066#ifdef <module>_AUTOINIT_INCLUDE
3067#include <module>_AUTOINIT_INCLUDE
3069#ifdef <module>_AUTOINIT
3076its path via the `<module>_AUTOINIT_INCLUDE` define. once it has been included,
3077if the `<module>_AUTOINIT` symbol is defined, a header is included which is
3079module
name and should use `<module>_AUTOINIT` to fill in the factories in the
3080module with those from the `IMPLEMENTS` modules listed in that symbol.
3082The `<
module>_AUTOINIT` symbol's value is:
3085<count>(<module1>,<module2>,<module3>)
3088where `<count>` is the number of modules in the parentheses and each module
3089listed need to register something to `<module>`.
3091If not provided via the `AUTOINIT_INCLUDE` argument to the
3092@ref vtk_module_add_module function, the header to use is fetched from the
3093`_vtk_module_autoinit_include` global property. This only needs to be managed
3094in modules that `IMPLEMENTS` or are `IMPLEMENTABLE`. This should be provided by
3095projects using the module system at its lowest level. Projects not implementing
3096the `VTK_MODULE_AUTOINIT` macro should have its value provided by
3097`find_package` dependencies in some way.
3102@brief Linking to autoinit-using modules
3104When linking to modules, in order for the autoinit system to work, modules need
3105to declare their registration. In order to do this, defines may need to be
3106provided to targets in order to trigger registration. These defines may be
3107added to targets by using this function.
3112 MODULES <module>...)
3115After this call, the targets given to the `TARGETS` argument will gain the
3116preprocessor definitions to trigger registrations properly.
3118function (vtk_module_autoinit)
3119 cmake_parse_arguments(PARSE_ARGV 0 _vtk_autoinit
3124 if (_vtk_autoinit_UNRECOGNIZED_ARGUMENTS)
3127 "${_vtk_autoinit_UNRECOGNIZED_ARGUMENTS}.
")
3130 if (NOT _vtk_autoinit_TARGETS)
3132 "The `TARGETS` argument is required.
")
3135 if (NOT _vtk_autoinit_MODULES)
3136 message(AUTHOR_WARNING
3137 "No `MODULES` passed to `vtk_modules_autoinit`.
")
3140 set(_vtk_autoinit_module_stack
3141 ${_vtk_autoinit_MODULES})
3143 set(_vtk_autoinit_needs_implements)
3144 set(_vtk_autoinit_seen)
3145 while (_vtk_autoinit_module_stack)
3146 list(GET _vtk_autoinit_module_stack 0 _vtk_autoinit_current_module)
3147 list(REMOVE_AT _vtk_autoinit_module_stack 0)
3148 if (_vtk_autoinit_current_module IN_LIST _vtk_autoinit_seen)
3151 list(APPEND _vtk_autoinit_seen
3152 "${_vtk_autoinit_current_module}
")
3154 _vtk_module_real_target(_vtk_autoinit_current_target "${_vtk_autoinit_current_module}
")
3155 get_property(_vtk_autoinit_implements
3156 TARGET "${_vtk_autoinit_current_target}
"
3157 PROPERTY "INTERFACE_vtk_module_implements
")
3159 list(APPEND _vtk_autoinit_needs_implements
3160 ${_vtk_autoinit_implements})
3161 foreach (_vtk_autoinit_implement IN LISTS _vtk_autoinit_implements)
3162 _vtk_module_real_target(_vtk_autoinit_implements_target "${_vtk_autoinit_implement}
")
3163 get_property(_vtk_autoinit_implementable
3164 TARGET "${_vtk_autoinit_implements_target}
"
3165 PROPERTY "INTERFACE_vtk_module_implementable
")
3167 if (NOT _vtk_autoinit_implementable)
3169 "The `${_vtk_autoinit_current_module}`
module says that it "
3170 "implements the `${_vtk_autoinit_implement}` module, but it is not "
3174 list(APPEND "_vtk_autoinit_implements_${_vtk_autoinit_implement}"
3175 "${_vtk_autoinit_current_module}")
3179 if (NOT _vtk_autoinit_needs_implements)
3182 list(REMOVE_DUPLICATES _vtk_autoinit_needs_implements)
3183 list(SORT _vtk_autoinit_needs_implements)
3185 set(_vtk_autoinit_hash_content)
3186 foreach (_vtk_autoinit_need_implements IN LISTS _vtk_autoinit_needs_implements)
3187 if (NOT _vtk_autoinit_implements_${_vtk_autoinit_need_implements})
3190 list(SORT "_vtk_autoinit_implements_${_vtk_autoinit_need_implements}")
3192 string(APPEND _vtk_autoinit_hash_content
3193 "${_vtk_autoinit_need_implements}: ${_vtk_autoinit_implements_${_vtk_autoinit_need_implements}}\n")
3195 string(MD5 _vtk_autoinit_header_tag "${_vtk_autoinit_hash_content}")
3196 set(_vtk_autoinit_header
3197 "${CMAKE_BINARY_DIR}/CMakeFiles/vtkModuleAutoInit_${_vtk_autoinit_header_tag}.h")
3199 get_property(_vtk_autoinit_header_generated GLOBAL
3200 PROPERTY "_vtk_autoinit_generated_${_vtk_autoinit_header_tag}")
3202 set(_vtk_autoinit_defines)
3203 set(_vtk_autoinit_header_content)
3204 foreach (_vtk_autoinit_need_implements IN LISTS _vtk_autoinit_needs_implements)
3205 if (NOT _vtk_autoinit_implements_${_vtk_autoinit_need_implements})
3209 get_property(_vtk_autoinit_implements_library_name
3210 TARGET "${_vtk_autoinit_need_implements}"
3211 PROPERTY "INTERFACE_vtk_module_library_name")
3213 if (NOT _vtk_autoinit_header_generated)
3214 list(LENGTH "_vtk_autoinit_implements_${_vtk_autoinit_need_implements}"
3215 _vtk_autoinit_length)
3216 set(_vtk_autoinit_args)
3217 foreach (_vtk_autoinit_arg IN LISTS "_vtk_autoinit_implements_${_vtk_autoinit_need_implements}")
3218 get_property(_vtk_autoinit_arg_library_name
3219 TARGET "${_vtk_autoinit_arg}"
3220 PROPERTY "INTERFACE_vtk_module_library_name")
3221 list(APPEND _vtk_autoinit_args
3222 "${_vtk_autoinit_arg_library_name}")
3224 string(REPLACE ";
" ",
" _vtk_autoinit_args "${_vtk_autoinit_args}
")
3225 string(APPEND _vtk_autoinit_header_content
3226 "#define ${_vtk_autoinit_implements_library_name}_AUTOINIT ${_vtk_autoinit_length}(${_vtk_autoinit_args})\n
")
3229 list(APPEND _vtk_autoinit_defines
3230 "${_vtk_autoinit_implements_library_name}_AUTOINIT_INCLUDE=\
"${_vtk_autoinit_header}\"")
3233 if (NOT _vtk_autoinit_header_generated)
3235 OUTPUT
"${_vtk_autoinit_header}"
3236 CONTENT
"${_vtk_autoinit_header_content}")
3240 "_vtk_autoinit_generated_${_vtk_autoinit_header_tag}" TRUE)
3243 foreach (_vtk_autoinit_target IN LISTS _vtk_autoinit_TARGETS)
3244 get_property(_vtk_autoinit_target_type
3245 TARGET
"${_vtk_autoinit_target}"
3247 if (_vtk_autoinit_target_type STREQUAL
"INTERFACE_LIBRARY")
3251 target_compile_definitions(
"${_vtk_autoinit_target}"
3253 ${_vtk_autoinit_defines})
3259@brief Generate the hierarchy
for a module
3261Write wrap hierarchy files
for the module currently being built. This also
3262installs the hierarchy file
for use by dependent projects
if `INSTALL_HEADERS`
3266_vtk_module_write_wrap_hierarchy()
3270 file(MAKE_DIRECTORY
"${CMAKE_BINARY_DIR}/${_vtk_build_HIERARCHY_DESTINATION}")
3272 get_property(_vtk_hierarchy_library_name GLOBAL
3273 PROPERTY
"_vtk_module_${_vtk_build_module}_library_name")
3274 set(_vtk_hierarchy_filename
"${_vtk_hierarchy_library_name}-hierarchy.txt")
3275 set(_vtk_hierarchy_file
"${CMAKE_BINARY_DIR}/${_vtk_build_HIERARCHY_DESTINATION}/${_vtk_hierarchy_filename}")
3276 set(_vtk_hierarchy_args_file
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_hierarchy_library_name}-hierarchy.$<CONFIGURATION>.args")
3277 set(_vtk_hierarchy_data_file
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_hierarchy_library_name}-hierarchy.data")
3278 set(_vtk_hierarchy_depends_args_file
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_hierarchy_library_name}-hierarchy.depends.args")
3280 set_property(TARGET
"${_vtk_add_module_real_target}"
3282 "INTERFACE_vtk_module_hierarchy" "${_vtk_hierarchy_file}")
3284 set(_vtk_add_module_target_name_iface
"${_vtk_add_module_target_name}")
3285 if (_vtk_add_module_build_with_kit)
3286 string(APPEND _vtk_add_module_target_name_iface
"-objects")
3288 set(_vtk_hierarchy_genex_compile_definitions
3289 "$<TARGET_PROPERTY:${_vtk_add_module_target_name_iface},COMPILE_DEFINITIONS>")
3290 set(_vtk_hierarchy_genex_include_directories
3291 "$<TARGET_PROPERTY:${_vtk_add_module_target_name_iface},INCLUDE_DIRECTORIES>")
3293 OUTPUT
"${_vtk_hierarchy_args_file}"
3294 CONTENT
"$<$<BOOL:${_vtk_hierarchy_genex_compile_definitions}>:\n-D\'$<JOIN:${_vtk_hierarchy_genex_compile_definitions},\'\n-D\'>\'>\n
3295$<$<BOOL:${_vtk_hierarchy_genex_include_directories}>:\n-I\'$<JOIN:${_vtk_hierarchy_genex_include_directories},\'\n-I\'>\'>\n")
3297 get_property(_vtk_hierarchy_depends_is_global GLOBAL
3298 PROPERTY
"_vtk_module_${_vtk_build_module}_depends"
3300 if (_vtk_hierarchy_depends_is_global)
3301 get_property(_vtk_hierarchy_depends GLOBAL
3302 PROPERTY
"_vtk_module_${_vtk_build_module}_depends")
3304 get_property(_vtk_hierarchy_depends GLOBAL
3305 TARGET
"${_vtk_add_module_real_target}"
3306 PROPERTY
"INTERFACE_vtk_module_depends")
3309 set(_vtk_hierarchy_depends_files)
3310 set(_vtk_hierarchy_depends_targets)
3311 foreach (_vtk_hierarchy_depend IN LISTS _vtk_hierarchy_depends)
3313 PROPERTY
"hierarchy"
3314 VARIABLE _vtk_hierarchy_depend_hierarchy)
3315 if (NOT DEFINED _vtk_hierarchy_depend_hierarchy)
3319 list(APPEND _vtk_hierarchy_depends_files
3320 "${_vtk_hierarchy_depend_hierarchy}")
3322 # Find the hierarchy target of the module.
3323 get_property(_vtk_hierarchy_module_is_imported
3324 TARGET
"${_vtk_hierarchy_depend}"
3326 # Imported target modules are external and should already have their file
3328 if (_vtk_hierarchy_module_is_imported)
3332 get_property(_vtk_hierarchy_depend_library_name GLOBAL
3333 PROPERTY
"_vtk_module_${_vtk_hierarchy_depend}_library_name")
3334 if (TARGET
"${_vtk_hierarchy_depend_library_name}-hierarchy")
3335 list(APPEND _vtk_hierarchy_depends_targets
3336 "${_vtk_hierarchy_depend_library_name}-hierarchy")
3340 set(_vtk_hierarchy_depends_files_arg)
3341 if (_vtk_hierarchy_depends_files)
3343 OUTPUT
"${_vtk_hierarchy_depends_args_file}"
3344 CONTENT
"\"$<JOIN:${_vtk_hierarchy_depends_files},\"\n\">\"\n")
3347 OUTPUT
"${_vtk_hierarchy_depends_args_file}"
3353 VARIABLE _vtk_hierarchy_headers)
3354 set(_vtk_hierarchy_data_content
"")
3355 foreach (_vtk_hierarchy_header IN LISTS _vtk_hierarchy_headers)
3356 string(APPEND _vtk_hierarchy_data_content
3357 "${_vtk_hierarchy_header};${_vtk_hierarchy_library_name}\n")
3360 OUTPUT
"${_vtk_hierarchy_data_file}"
3361 CONTENT
"${_vtk_hierarchy_data_content}")
3363 if (CMAKE_GENERATOR MATCHES
"Ninja")
3364 set(_vtk_hierarchy_command_depends ${_vtk_hierarchy_depends_files})
3366 set(_vtk_hierarchy_command_depends ${_vtk_hierarchy_depends_targets})
3369 set(_vtk_hierarchy_tool_target
"VTK::WrapHierarchy")
3370 set(_vtk_hierarchy_macros_args)
3371 if (TARGET VTKCompileTools::WrapHierarchy)
3372 set(_vtk_hierarchy_tool_target
"VTKCompileTools::WrapHierarchy")
3373 if (TARGET VTKCompileTools_macros)
3374 list(APPEND _vtk_hierarchy_command_depends
3375 "VTKCompileTools_macros")
3376 list(APPEND _vtk_hierarchy_macros_args
3378 -imacros
"${_VTKCompileTools_macros_file}")
3383 OUTPUT
"${_vtk_hierarchy_file}"
3384 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}
3385 "$<TARGET_FILE:${_vtk_hierarchy_tool_target}>"
3386 "@${_vtk_hierarchy_args_file}"
3387 -o
"${_vtk_hierarchy_file}"
3388 "${_vtk_hierarchy_data_file}"
3389 "@${_vtk_hierarchy_depends_args_file}"
3390 ${_vtk_hierarchy_macros_args}
3391 COMMENT
"Generating the wrap hierarchy for ${_vtk_build_module}"
3393 ${_vtk_hierarchy_headers}
3394 "${_vtk_hierarchy_args_file}"
3395 "${_vtk_hierarchy_data_file}"
3396 "${_vtk_hierarchy_depends_args_file}"
3397 ${_vtk_hierarchy_command_depends})
3398 add_custom_target(
"${_vtk_add_module_library_name}-hierarchy" ALL
3400 "${_vtk_hierarchy_file}"
3401 "$<TARGET_FILE:${_vtk_hierarchy_tool_target}>")
3402 set_property(TARGET
"${_vtk_add_module_real_target}"
3404 "INTERFACE_vtk_module_hierarchy" "${_vtk_hierarchy_file}")
3406 if (_vtk_build_INSTALL_HEADERS)
3407 set(_vtk_hierarchy_headers_component
"${_vtk_build_HEADERS_COMPONENT}")
3408 if (_vtk_build_TARGET_SPECIFIC_COMPONENTS)
3409 string(PREPEND _vtk_hierarchy_headers_component
"${_vtk_build_module}-")
3410 if (_vtk_build_BUILD_WITH_KITS)
3411 get_property(_vtk_hierarchy_build_with_kit GLOBAL
3412 PROPERTY
"_vtk_module_${_vtk_build_module}_kit")
3413 if (_vtk_hierarchy_build_with_kit)
3414 set(_vtk_hierarchy_headers_component
"${_vtk_hierarchy_build_with_kit}-${_vtk_build_HEADERS_COMPONENT}")
3418 set_property(TARGET
"${_vtk_add_module_real_target}"
3420 "INTERFACE_vtk_module_hierarchy_install" "\${_vtk_module_import_prefix}/${_vtk_build_HIERARCHY_DESTINATION}/${_vtk_hierarchy_filename}")
3422 FILES
"${_vtk_hierarchy_file}"
3423 DESTINATION
"${_vtk_build_HIERARCHY_DESTINATION}"
3424 RENAME
"${_vtk_hierarchy_filename}"
3425 COMPONENT
"${_vtk_hierarchy_headers_component}")
3429include(GenerateExportHeader)
3433@brief Create a module library
3436vtk_module_add_module(<name>
3437 [FORCE_STATIC] [HEADER_ONLY] [HEADER_DIRECTORIES]
3438 [EXPORT_MACRO_PREFIX <prefix>]
3439 [HEADERS_SUBDIR <subdir>]
3440 [LIBRARY_NAME_SUFFIX <suffix>]
3441 [CLASSES <class>...]
3442 [TEMPLATE_CLASSES <template class>...]
3443 [NOWRAP_CLASSES <nowrap class>...]
3444 [NOWRAP_TEMPLATE_CLASSES <nowrap template class>...]
3445 [SOURCES <source>...]
3446 [HEADERS <header>...]
3447 [NOWRAP_HEADERS <header>...]
3448 [TEMPLATES <template>...]
3449 [PRIVATE_CLASSES <class>...]
3450 [PRIVATE_TEMPLATE_CLASSES <template class>...]
3451 [PRIVATE_HEADERS <header>...]
3452 [PRIVATE_TEMPLATES <template>...])
3455The `PRIVATE_` arguments are analogous to their non-`PRIVATE_` arguments, but
3456the associated files are not installed or available
for wrapping (`SOURCES` are
3457always
private, so there is no `PRIVATE_` variant
for that argument).
3459 * `FORCE_STATIC`: For a
static library to be created. If not provided,
3460 `BUILD_SHARED_LIBS` will control the library
type.
3461 * `HEADER_ONLY`: The module only contains headers (or templates) and contains
3462 no compilation steps. Mutually exclusive with `FORCE_STATIC`.
3463 * `HEADER_DIRECTORIES`: The headers
for this module are in a directory
3464 structure which should be preserved in the install tree.
3465 * `EXPORT_MACRO_PREFIX`: The prefix
for the
export macro definitions.
3466 Defaults to the library
name of the module in all uppercase.
3467 * `HEADERS_SUBDIR`: The subdirectory to install headers into in the install
3469 * `LIBRARY_NAME_SUFFIX`: The suffix to the module
's library name if
3470 additional information is required.
3471 * `CLASSES`: A list of classes in the module. This is a shortcut for adding
3472 `<class>.cxx` to `SOURCES` and `<class>.h` to `HEADERS`.
3473 * `TEMPLATE_CLASSES`: A list of template classes in the module. This is a
3474 shortcut for adding `<class>.txx` to `TEMPLATES` and `<class>.h` to
3476 * `SOURCES`: A list of source files which require compilation.
3477 * `HEADERS`: A list of header files which will be available for wrapping and
3479 * `NOWRAP_CLASSES`: A list of classes which will not be available for
3480 wrapping but installed. This is a shortcut for adding `<class>.cxx` to
3481 `SOURCES` and `<class>.h` to `NOWRAP_HEADERS`.
3482 * `NOWRAP_TEMPLATE_CLASSES`: A list of template classes which will not be
3484 wrapping but installed. This is a shortcut for adding `<class>.txx` to
3485 `TEMPLATES` and `<class>.h` to `NOWRAP_HEADERS`.
3486 * `NOWRAP_HEADERS`: A list of header files which will not be available for
3487 wrapping but installed.
3488 * `TEMPLATES`: A list of template files which will be installed.
3490function (vtk_module_add_module name)
3491 if (NOT name STREQUAL _vtk_build_module)
3493 "The ${_vtk_build_module}'s CMakeLists.txt may not add the ${name}
module.")
3496 set(_vtk_add_module_source_keywords)
3497 foreach (_vtk_add_module_kind IN ITEMS CLASSES TEMPLATE_CLASSES HEADERS TEMPLATES)
3498 list(APPEND _vtk_add_module_source_keywords
3499 "${_vtk_add_module_kind}"
3500 "PRIVATE_${_vtk_add_module_kind}")
3503 cmake_parse_arguments(PARSE_ARGV 1 _vtk_add_module
3504 "FORCE_STATIC;HEADER_ONLY;HEADER_DIRECTORIES
"
3505 "EXPORT_MACRO_PREFIX;HEADERS_SUBDIR;LIBRARY_NAME_SUFFIX
"
3506 "${_vtk_add_module_source_keywords};SOURCES;NOWRAP_CLASSES;NOWRAP_TEMPLATE_CLASSES;NOWRAP_HEADERS
")
3508 if (_vtk_add_module_UNPARSED_ARGUMENTS)
3511 "${_vtk_add_module_UNPARSED_ARGUMENTS}
")
3514 if (NOT DEFINED _vtk_add_module_EXPORT_MACRO_PREFIX)
3515 _vtk_module_default_export_macro_prefix(_vtk_add_module_EXPORT_MACRO_PREFIX)
3518 if (_vtk_add_module_HEADER_ONLY AND _vtk_add_module_FORCE_STATIC)
3520 "The ${_vtk_build_module}
module cannot be header only yet forced "
3524 foreach (_vtk_add_module_class IN LISTS _vtk_add_module_CLASSES)
3525 list(APPEND _vtk_add_module_SOURCES
3526 "${_vtk_add_module_class}.cxx")
3527 list(APPEND _vtk_add_module_HEADERS
3528 "${_vtk_add_module_class}.h")
3531 foreach (_vtk_add_module_template_class IN LISTS _vtk_add_module_TEMPLATE_CLASSES)
3532 list(APPEND _vtk_add_module_TEMPLATES
3533 "${_vtk_add_module_template_class}.txx")
3534 list(APPEND _vtk_add_module_HEADERS
3535 "${_vtk_add_module_template_class}.h")
3538 foreach (_vtk_add_module_class IN LISTS _vtk_add_module_NOWRAP_CLASSES)
3539 list(APPEND _vtk_add_module_SOURCES
3540 "${_vtk_add_module_class}.cxx")
3541 list(APPEND _vtk_add_module_NOWRAP_HEADERS
3542 "${_vtk_add_module_class}.h")
3545 foreach (_vtk_add_module_class IN LISTS _vtk_add_module_NOWRAP_TEMPLATE_CLASSES)
3546 list(APPEND _vtk_add_module_TEMPLATES
3547 "${_vtk_add_module_class}.txx")
3548 list(APPEND _vtk_add_module_NOWRAP_HEADERS
3549 "${_vtk_add_module_class}.h")
3552 foreach (_vtk_add_module_class IN LISTS _vtk_add_module_PRIVATE_CLASSES)
3553 list(APPEND _vtk_add_module_SOURCES
3554 "${_vtk_add_module_class}.cxx")
3555 list(APPEND _vtk_add_module_PRIVATE_HEADERS
3556 "${_vtk_add_module_class}.h")
3559 foreach (_vtk_add_module_template_class IN LISTS _vtk_add_module_PRIVATE_TEMPLATE_CLASSES)
3560 list(APPEND _vtk_add_module_PRIVATE_TEMPLATES
3561 "${_vtk_add_module_template_class}.txx")
3562 list(APPEND _vtk_add_module_PRIVATE_HEADERS
3563 "${_vtk_add_module_template_class}.h")
3566 if (NOT _vtk_add_module_SOURCES AND NOT _vtk_add_module_HEADER_ONLY)
3568 "The ${_vtk_build_module} module has no source files.")
3571 get_property(_vtk_add_module_third_party GLOBAL
3572 PROPERTY "_vtk_module_${_vtk_build_module}_third_party")
3574 get_property(_vtk_add_module_library_name GLOBAL
3575 PROPERTY "_vtk_module_${_vtk_build_module}_library_name")
3576 set(_vtk_add_module_module_header_name
3577 "${_vtk_add_module_library_name}Module.h")
3578 if (NOT _vtk_add_module_HEADER_ONLY AND NOT _vtk_add_module_third_party)
3579 set(_vtk_add_module_generated_header
3580 "${CMAKE_CURRENT_BINARY_DIR}/${_vtk_add_module_module_header_name}")
3581 list(APPEND _vtk_add_module_HEADERS
3582 "${_vtk_add_module_generated_header}")
3585 set(_vtk_add_module_use_relative_paths)
3586 if (_vtk_add_module_HEADER_DIRECTORIES)
3587 set(_vtk_add_module_use_relative_paths
3591 vtk_module_install_headers(
3592 ${_vtk_add_module_use_relative_paths}
3593 FILES ${_vtk_add_module_HEADERS}
3594 ${_vtk_add_module_NOWRAP_HEADERS}
3595 ${_vtk_add_module_TEMPLATES}
3596 SUBDIR "${_vtk_add_module_HEADERS_SUBDIR}")
3598 set(_vtk_add_module_type)
3599 if (_vtk_add_module_FORCE_STATIC)
3600 set(_vtk_add_module_type STATIC)
3603 set(_vtk_add_module_build_with_kit)
3604 if (_vtk_build_BUILD_WITH_KITS)
3605 get_property(_vtk_add_module_build_with_kit GLOBAL
3606 PROPERTY "_vtk_module_${_vtk_build_module}_kit")
3609 get_property(_vtk_add_module_namespace GLOBAL
3610 PROPERTY "_vtk_module_${_vtk_build_module}_namespace")
3611 get_property(_vtk_add_module_target_name GLOBAL
3612 PROPERTY "_vtk_module_${_vtk_build_module}_target_name")
3613 set(_vtk_add_module_real_target "${_vtk_add_module_target_name}")
3614 if (_vtk_add_module_HEADER_ONLY)
3615 if (_vtk_add_module_build_with_kit)
3617 "The module ${_vtk_build_module} is header-only, but is part of the "
3618 "${_vtk_add_module_build_with_kit} kit. Header-only modules do not "
3622 add_library("${_vtk_add_module_real_target}" INTERFACE)
3624 if (NOT _vtk_build_module STREQUAL _vtk_add_module_real_target)
3625 add_library("${_vtk_build_module}" ALIAS
3626 "${_vtk_add_module_real_target}")
3629 if (_vtk_add_module_build_with_kit)
3630 add_library("${_vtk_add_module_real_target}" INTERFACE)
3631 target_link_libraries("${_vtk_add_module_real_target}"
3633 # For usage requirements.
3634 "${_vtk_add_module_real_target}-objects"
3635 # For the implementation.
3636 "$<LINK_ONLY:${_vtk_add_module_build_with_kit}>")
3638 if (NOT _vtk_build_module STREQUAL _vtk_add_module_real_target)
3639 add_library("${_vtk_build_module}" ALIAS
3640 "${_vtk_add_module_real_target}")
3643 # Set up properties necessary for other infrastructure.
3644 set_property(TARGET "${_vtk_add_module_real_target}"
3646 "INTERFACE_vtk_module_library_name" "${_vtk_add_module_library_name}")
3648 add_library("${_vtk_add_module_real_target}-objects" OBJECT
3649 ${_vtk_add_module_SOURCES}
3650 ${_vtk_add_module_TEMPLATES}
3651 ${_vtk_add_module_PRIVATE_TEMPLATES}
3652 ${_vtk_add_module_HEADERS}
3653 ${_vtk_add_module_NOWRAP_HEADERS}
3654 ${_vtk_add_module_PRIVATE_HEADERS})
3656 if (_vtk_build_UTILITY_TARGET)
3657 target_link_libraries("${_vtk_add_module_real_target}-objects"
3659 "${_vtk_build_UTILITY_TARGET}")
3662 set_target_properties("${_vtk_add_module_real_target}-objects"
3664 # Emulate the regular library as much as possible.
3665 DEFINE_SYMBOL "${_vtk_add_module_real_target}_EXPORT"
3666 POSITION_INDEPENDENT_CODE ON)
3667 target_compile_definitions("${_vtk_add_module_real_target}-objects"
3669 "${_vtk_add_module_real_target}_EXPORT")
3670 string(APPEND _vtk_add_module_real_target "-objects")
3672 add_library("${_vtk_add_module_real_target}" ${_vtk_add_module_type}
3673 ${_vtk_add_module_SOURCES}
3674 ${_vtk_add_module_TEMPLATES}
3675 ${_vtk_add_module_HEADERS}
3676 ${_vtk_add_module_PRIVATE_HEADERS})
3678 if (_vtk_build_UTILITY_TARGET)
3679 target_link_libraries("${_vtk_add_module_real_target}"
3681 "${_vtk_build_UTILITY_TARGET}")
3684 set_property(TARGET "${_vtk_add_module_real_target}"
3686 POSITION_INDEPENDENT_CODE ON)
3688 if (NOT _vtk_build_module STREQUAL _vtk_add_module_real_target)
3689 add_library("${_vtk_build_module}" ALIAS
3690 "${_vtk_add_module_real_target}")
3695 set_property(TARGET "${_vtk_add_module_real_target}"
3697 "INTERFACE_vtk_module_library_name" "${_vtk_add_module_library_name}")
3699 get_property(_vtk_add_module_depends GLOBAL
3700 PROPERTY "_vtk_module_${_vtk_build_module}_depends")
3701 set_property(TARGET "${_vtk_add_module_real_target}"
3703 "INTERFACE_vtk_module_depends" "${_vtk_add_module_depends}")
3704 set(_vtk_add_module_includes_interface)
3705 if (_vtk_add_module_HEADER_ONLY)
3706 target_link_libraries("${_vtk_add_module_real_target}"
3708 ${_vtk_add_module_depends})
3709 set(_vtk_add_module_includes_interface INTERFACE)
3711 get_property(_vtk_add_module_private_depends GLOBAL
3712 PROPERTY "_vtk_module_${_vtk_build_module}_private_depends")
3714 # XXX(cmake#18484): Linking dependencies directly currently creates
3715 # circular dependencies. This logic should be removed once the minimum for
3716 # kits contains a fix for the mentioned issue.
3718 # When two modules are part of the same kit, we can get this problem:
3720 # A - iface -> A-objects <- tll - K
3723 # B - iface -> B-objects <- tll -/
3725 # If B depends on A, it ends up with a circular dependency since A has a
3726 # `$<LINK_ONLY:K>` link. instead, munge up dependencies of intra-kit
3727 # dependencies to link to the `-objects` target instead.
3728 if (_vtk_add_module_build_with_kit)
3729 set(_vtk_add_module_depends_link)
3730 set(_vtk_add_module_private_depends_link)
3731 foreach (_vtk_add_module_depend IN LISTS _vtk_add_module_depends)
3732 get_property(_vtk_add_module_depend_kit GLOBAL
3733 PROPERTY "_vtk_module_${_vtk_add_module_depend}_kit")
3734 if (_vtk_add_module_depend_kit STREQUAL _vtk_add_module_build_with_kit)
3735 # We're in the same kit; depend
on the `-objects` library of the
3737 get_property(_vtk_add_module_depend_target_name GLOBAL
3738 PROPERTY
"_vtk_module_${_vtk_add_module_depend}_target_name")
3739 list(APPEND _vtk_add_module_depends_link
3740 "${_vtk_add_module_depend_target_name}-objects")
3742 # Different kit, just use as normal.
3743 list(APPEND _vtk_add_module_depends_link
3744 "${_vtk_add_module_depend}")
3747 foreach (_vtk_add_module_private_depend IN LISTS _vtk_add_module_private_depends)
3748 get_property(_vtk_add_module_private_depend_kit GLOBAL
3749 PROPERTY
"_vtk_module_${_vtk_add_module_private_depend}_kit")
3750 if (_vtk_add_module_private_depend_kit STREQUAL _vtk_add_module_build_with_kit)
3751 # We're in the same kit; depend on the `-objects` library of the
3753 get_property(_vtk_add_module_private_depend_target_name GLOBAL
3754 PROPERTY
"_vtk_module_${_vtk_add_module_private_depend}_target_name")
3755 list(APPEND _vtk_add_module_private_depends_link
3756 "${_vtk_add_module_private_depend_target_name}-objects")
3758 # Different kit, just use as normal.
3759 list(APPEND _vtk_add_module_private_depends_link
3760 "${_vtk_add_module_private_depend}")
3764 # Add the `DEFINE_SYMBOL` for all other modules within the same kit which
3765 # have already been processed because the direct dependencies are not
3766 # sufficient: export symbols from any included header needs to be
3767 # correct. Since modules are built in topological order, a module can
3768 # only possibly include modules in the kit which have already been built.
3769 get_property(_vtk_add_module_kit_modules GLOBAL
3770 PROPERTY
"_vtk_kit_${_vtk_add_module_build_with_kit}_kit_modules")
3771 list(REMOVE_ITEM _vtk_add_module_kit_modules
"${_vtk_build_module}")
3772 foreach (_vtk_add_module_kit_module IN LISTS _vtk_add_module_kit_modules)
3773 get_property(_vtk_add_module_kit_module_target_name GLOBAL
3774 PROPERTY
"_vtk_module_${_vtk_add_module_kit_module}_target_name")
3775 if (TARGET
"${_vtk_add_module_kit_module_target_name}-objects")
3776 get_property(_vtk_add_module_kit_module_define_symbol
3777 TARGET
"${_vtk_add_module_kit_module_target_name}-objects"
3778 PROPERTY DEFINE_SYMBOL)
3779 target_compile_definitions(
"${_vtk_add_module_real_target}"
3781 "${_vtk_add_module_kit_module_define_symbol}")
3785 set(_vtk_add_module_depends_link ${_vtk_add_module_depends})
3786 set(_vtk_add_module_private_depends_link ${_vtk_add_module_private_depends})
3788 target_link_libraries(
"${_vtk_add_module_real_target}"
3790 ${_vtk_add_module_depends_link}
3792 ${_vtk_add_module_private_depends_link})
3794 set(_vtk_add_module_private_depends_forward_link)
3795 foreach (_vtk_add_module_private_depend IN LISTS _vtk_add_module_depends_link _vtk_add_module_private_depends)
3797 PROPERTY
"forward_link"
3798 VARIABLE _vtk_add_module_forward_link)
3799 list(APPEND _vtk_add_module_private_depends_forward_link
3800 ${_vtk_add_module_forward_link})
3803 get_property(_vtk_add_module_optional_depends GLOBAL
3804 PROPERTY
"_vtk_module_${_vtk_build_module}_optional_depends")
3805 foreach (_vtk_add_module_optional_depend IN LISTS _vtk_add_module_optional_depends)
3806 if (TARGET
"${_vtk_add_module_optional_depend}")
3807 set(_vtk_add_module_optional_depend_link
"${_vtk_add_module_optional_depend}")
3808 if (_vtk_add_module_build_with_kit)
3809 get_property(_vtk_add_module_optional_depend_kit GLOBAL
3810 PROPERTY
"_vtk_module_${_vtk_add_module_optional_depend}_kit")
3811 if (_vtk_add_module_optional_depend_kit STREQUAL _vtk_add_module_build_with_kit)
3812 # We're in the same kit; depend on the `-objects` library of the
3813 # module to avoid circular dependency (see explanation earlier)
3814 get_property(_vtk_add_module_optional_depend_target_name GLOBAL
3815 PROPERTY
"_vtk_module_${_vtk_add_module_optional_depend}_target_name")
3816 set(_vtk_add_module_optional_depend_link
"${_vtk_add_module_optional_depend_target_name}-objects")
3820 PROPERTY
"forward_link"
3821 VARIABLE _vtk_add_module_forward_link)
3822 list(APPEND _vtk_add_module_private_depends_forward_link
3823 ${_vtk_add_module_forward_link})
3824 target_link_libraries(
"${_vtk_add_module_real_target}"
3826 "${_vtk_add_module_optional_depend_link}")
3828 string(REPLACE
"::" "_" _vtk_add_module_optional_depend_safe
"${_vtk_add_module_optional_depend}")
3829 target_compile_definitions(
"${_vtk_add_module_real_target}"
3831 "VTK_MODULE_ENABLE_${_vtk_add_module_optional_depend_safe}=$<TARGET_EXISTS:${_vtk_add_module_optional_depend}>")
3834 if (_vtk_add_module_private_depends_forward_link)
3835 list(REMOVE_DUPLICATES _vtk_add_module_private_depends_forward_link)
3837 PROPERTY
"forward_link"
3838 VALUE
"${_vtk_add_module_private_depends_forward_link}")
3839 target_link_libraries(
"${_vtk_add_module_real_target}"
3841 "${_vtk_add_module_private_depends_forward_link}")
3845 TARGET
"${_vtk_add_module_real_target}"
3846 ${_vtk_add_module_includes_interface}
3847 HEADERS_DESTINATION
"${_vtk_build_HEADERS_DESTINATION}")
3850 MODULES ${_vtk_add_module_depends}
3851 ${_vtk_add_module_private_depends}
3852 "${_vtk_build_module}"
3853 TARGETS
"${_vtk_add_module_real_target}")
3855 set(_vtk_add_module_headers_build)
3856 set(_vtk_add_module_headers_install)
3857 # TODO: Perform this in `vtk_module_install_headers` so that manually
3858 # installed headers may participate in wrapping as well.
3859 foreach (_vtk_add_module_header IN LISTS _vtk_add_module_HEADERS)
3860 if (IS_ABSOLUTE
"${_vtk_add_module_header}")
3861 list(APPEND _vtk_add_module_headers_build
3862 "${_vtk_add_module_header}")
3864 list(APPEND _vtk_add_module_headers_build
3865 "${CMAKE_CURRENT_SOURCE_DIR}/${_vtk_add_module_header}")
3868 get_filename_component(_vtk_add_module_header_name
"${_vtk_add_module_header}" NAME)
3869 list(APPEND _vtk_add_module_headers_install
3870 "\${_vtk_module_import_prefix}/${_vtk_build_HEADERS_DESTINATION}/${_vtk_add_module_header_name}")
3873 set_property(TARGET
"${_vtk_add_module_real_target}"
3875 "INTERFACE_vtk_module_headers" "${_vtk_add_module_headers_build}")
3876 if (_vtk_build_INSTALL_HEADERS)
3877 set_property(TARGET
"${_vtk_add_module_real_target}"
3879 "INTERFACE_vtk_module_headers_install" "${_vtk_add_module_headers_install}")
3882 get_property(_vtk_add_module_exclude_wrap GLOBAL
3883 PROPERTY
"_vtk_module_${_vtk_build_module}_exclude_wrap")
3884 set_property(TARGET
"${_vtk_add_module_real_target}"
3886 "INTERFACE_vtk_module_exclude_wrap" "${_vtk_add_module_exclude_wrap}")
3887 if (NOT _vtk_add_module_exclude_wrap AND _vtk_build_ENABLE_WRAPPING)
3891 set(_vtk_add_module_module_content)
3893 if (NOT _vtk_add_module_AUTOINIT_INCLUDE)
3894 get_property(_vtk_add_module_AUTOINIT_INCLUDE GLOBAL
3895 PROPERTY
"_vtk_module_autoinit_include")
3898 set(_vtk_add_module_autoinit_include_header)
3899 if (_vtk_add_module_AUTOINIT_INCLUDE)
3900 set(_vtk_add_module_autoinit_include_header
3901 "#include ${_vtk_add_module_AUTOINIT_INCLUDE}")
3904 set(_vtk_add_module_autoinit_depends_includes)
3905 foreach (_vtk_add_module_autoinit_dependency IN LISTS _vtk_add_module_depends)
3906 get_property(_vtk_add_module_autoinit_dependency_target_name GLOBAL
3907 PROPERTY
"_vtk_module_${_vtk_add_module_autoinit_dependency}_target_name")
3908 if (_vtk_add_module_autoinit_dependency_target_name)
3909 get_property(_vtk_add_module_depends_needs_autoinit
3910 TARGET
"${_vtk_add_module_autoinit_dependency_target_name}"
3911 PROPERTY
"INTERFACE_vtk_module_needs_autoinit")
3913 set(_vtk_add_module_autoinit_dependency_target_name
3914 "${_vtk_add_module_autoinit_dependency}")
3915 get_property(_vtk_add_module_depends_needs_autoinit
3916 TARGET
"${_vtk_add_module_autoinit_dependency}"
3917 PROPERTY
"INTERFACE_vtk_module_needs_autoinit")
3919 if (NOT _vtk_add_module_depends_needs_autoinit)
3922 get_property(_vtk_add_module_depends_library_name
3923 TARGET
"${_vtk_add_module_autoinit_dependency_target_name}"
3924 PROPERTY
"INTERFACE_vtk_module_library_name")
3926 string(APPEND _vtk_add_module_autoinit_depends_includes
3927 "#include \"${_vtk_add_module_depends_library_name}Module.h\"\n")
3930 set(_vtk_add_module_autoinit_content)
3931 if (_vtk_add_module_autoinit_depends_includes)
3932 string(APPEND _vtk_add_module_autoinit_content
3933 "/* AutoInit dependencies. */\n${_vtk_add_module_autoinit_depends_includes}\n")
3936 get_property(_vtk_add_module_implementable GLOBAL
3937 PROPERTY
"_vtk_module_${_vtk_build_module}_implementable")
3938 get_property(_vtk_add_module_implements GLOBAL
3939 PROPERTY
"_vtk_module_${_vtk_build_module}_implements")
3940 if (_vtk_add_module_implementable)
3941 set_property(TARGET
"${_vtk_add_module_real_target}"
3943 "INTERFACE_vtk_module_implementable" 1)
3946 if (_vtk_add_module_implementable OR _vtk_add_module_implements)
3947 set_property(TARGET
"${_vtk_add_module_real_target}"
3949 "INTERFACE_vtk_module_implements" "${_vtk_add_module_implements}")
3950 set_property(TARGET
"${_vtk_add_module_real_target}"
3952 "INTERFACE_vtk_module_needs_autoinit" 1)
3954 string(APPEND _vtk_add_module_autoinit_content
3956/* AutoInit implementations. */
3957#ifdef ${_vtk_add_module_library_name}_AUTOINIT_INCLUDE
3958#include ${_vtk_add_module_library_name}_AUTOINIT_INCLUDE
3960#ifdef ${_vtk_add_module_library_name}_AUTOINIT
3961${_vtk_add_module_autoinit_include_header}
3962VTK_MODULE_AUTOINIT(${_vtk_add_module_library_name})
3966 string(APPEND _vtk_add_module_module_content
3967 "${_vtk_add_module_autoinit_content}")
3970 if (NOT _vtk_add_module_HEADER_ONLY AND NOT _vtk_add_module_third_party)
3971 generate_export_header(
"${_vtk_add_module_real_target}"
3972 EXPORT_MACRO_NAME
"${_vtk_add_module_EXPORT_MACRO_PREFIX}_EXPORT"
3973 NO_EXPORT_MACRO_NAME
"${_vtk_add_module_EXPORT_MACRO_PREFIX}_NO_EXPORT"
3974 DEPRECATED_MACRO_NAME
"${_vtk_add_module_EXPORT_MACRO_PREFIX}_DEPRECATED"
3975 NO_DEPRECATED_MACRO_NAME
"${_vtk_add_module_EXPORT_MACRO_PREFIX}_NO_DEPRECATED"
3976 STATIC_DEFINE
"${_vtk_add_module_EXPORT_MACRO_PREFIX}_STATIC_DEFINE"
3977 EXPORT_FILE_NAME
"${_vtk_add_module_module_header_name}"
3978 CUSTOM_CONTENT_FROM_VARIABLE _vtk_add_module_module_content)
3985 if (_vtk_add_module_build_with_kit)
3989 get_property(_vtk_add_module_LICENSE_FILES GLOBAL
3990 PROPERTY
"_vtk_module_${_vtk_build_module}_license_files")
3991 if (_vtk_add_module_LICENSE_FILES)
3992 if (_vtk_build_TARGET_SPECIFIC_COMPONENTS)
3993 string(PREPEND _vtk_build_LICENSE_COMPONENT
"${_vtk_build_module}-")
3996 FILES ${_vtk_add_module_LICENSE_FILES}
3997 DESTINATION
"${_vtk_build_LICENSE_DESTINATION}/${_vtk_add_module_library_name}/"
3998 COMPONENT
"${_vtk_build_LICENSE_COMPONENT}")
4005@brief Add header tests
for a module
4007@todo Move
this function out to be VTK-specific, probably into
4008`vtkModuleTesting.cmake`. Each module would then need to manually call
this
4009function. It currently assumes it is in VTK itself.
4012_vtk_module_add_header_tests()
4016 if (NOT BUILD_TESTING)
4020 get_property(_vtk_add_header_tests_is_third_party GLOBAL
4021 PROPERTY
"_vtk_module_${_vtk_build_module}_third_party")
4022 if (_vtk_add_header_tests_is_third_party)
4026 # TODO: Add test compiles which include each header file to ensure that
4027 # public headers have their includes satisfied by a public dependency.
4030 if (NOT Python${VTK_PYTHON_VERSION}_EXECUTABLE)
4035 if (NOT VTK_SOURCE_DIR)
4040 NAME
"${_vtk_build_module}-HeaderTest"
4041 COMMAND
"${Python${VTK_PYTHON_VERSION}_EXECUTABLE}"
4042 # TODO: What to
do when
using this from a VTK install?
4043 "${VTK_SOURCE_DIR}/Testing/Core/HeaderTesting.py"
4044 "${CMAKE_CURRENT_SOURCE_DIR}"
4045 "${_vtk_add_module_EXPORT_MACRO}")
4050@brief Install headers
4053function already. However, sometimes header structures are more complicated and
4054need to be installed manually. This is common
for third party modules or
4055projects which use more than a single directory of headers
for a module.
4057To facilitate the installation of headers in various ways, the
this function is
4058available. This function honors the `INSTALL_HEADERS`, `HEADERS_DESTINATION`,
4063 [USE_RELATIVE_PATHS]
4064 [DIRECTORIES <directory>...]
4069Installation of header directories follows CMake
's `install` function semantics
4070with respect to trailing slashes.
4072If `USE_RELATIVE_PATHS` is given, the directory part of any listed files will
4073be added to the destination. Absolute paths will be computed relative to
4074`${CMAKE_CURRENT_BINARY_DIR}`.
4076function (vtk_module_install_headers)
4077 cmake_parse_arguments(PARSE_ARGV 0 _vtk_install_headers
4078 "USE_RELATIVE_PATHS"
4080 "FILES;DIRECTORIES")
4082 if (_vtk_install_headers_UNPARSED_ARGUMENTS)
4084 "Unparsed arguments for vtk_module_install_headers: "
4085 "${_vtk_install_headers_UNPARSED_ARGUMENTS}")
4088 if (NOT _vtk_build_INSTALL_HEADERS)
4092 if (NOT _vtk_install_headers_FILES AND NOT _vtk_install_headers_DIRECTORIES)
4096 set(_vtk_install_headers_destination
4097 "${_vtk_build_HEADERS_DESTINATION}/${_vtk_install_headers_SUBDIR}")
4098 set(_vtk_install_headers_headers_component "${_vtk_build_HEADERS_COMPONENT}")
4099 if (_vtk_build_TARGET_SPECIFIC_COMPONENTS)
4100 string(PREPEND _vtk_install_headers_headers_component "${_vtk_build_module}-")
4101 if (_vtk_build_BUILD_WITH_KITS)
4102 get_property(_vtk_install_headers_build_with_kit GLOBAL
4103 PROPERTY "_vtk_module_${_vtk_build_module}_kit")
4104 if (_vtk_install_headers_build_with_kit)
4105 set(_vtk_install_headers_headers_component "${_vtk_install_headers_build_with_kit}-${_vtk_build_HEADERS_COMPONENT}")
4109 if (_vtk_install_headers_USE_RELATIVE_PATHS)
4110 set(_vtk_install_headers_destination_file_subdir "")
4111 foreach (_vtk_install_headers_file IN LISTS _vtk_install_headers_FILES)
4112 if (IS_ABSOLUTE "${_vtk_install_headers_file}")
4113 file(RELATIVE_PATH _vtk_install_headers_destination_file_from_binary_dir
4114 "${CMAKE_CURRENT_BINARY_DIR}"
4115 "${_vtk_install_headers_file}")
4116 get_filename_component(_vtk_install_headers_destination_file_subdir "${_vtk_install_headers_destination_file_from_binary_dir}" DIRECTORY)
4118 get_filename_component(_vtk_install_headers_destination_file_subdir "${_vtk_install_headers_file}" DIRECTORY)
4121 FILES ${_vtk_install_headers_file}
4122 DESTINATION "${_vtk_install_headers_destination}/${_vtk_install_headers_destination_file_subdir}"
4123 COMPONENT "${_vtk_install_headers_headers_component}")
4125 elseif (_vtk_install_headers_FILES)
4127 FILES ${_vtk_install_headers_FILES}
4128 DESTINATION "${_vtk_install_headers_destination}"
4129 COMPONENT "${_vtk_install_headers_headers_component}")
4131 set(_vtk_install_headers_destination_directory_subdir "")
4132 foreach (_vtk_install_headers_directory IN LISTS _vtk_install_headers_DIRECTORIES)
4133 if (_vtk_install_headers_USE_RELATIVE_PATHS)
4134 if (IS_ABSOLUTE "${_vtk_install_headers_directory}")
4135 file(RELATIVE_PATH _vtk_install_headers_destination_directory_from_binary_dir
4136 "${CMAKE_CURRENT_BINARY_DIR}"
4137 "${_vtk_install_headers_directory}")
4138 get_filename_component(_vtk_install_headers_destination_directory_subdir "${_vtk_install_headers_destination_directory_from_binary_dir}" DIRECTORY)
4140 get_filename_component(_vtk_install_headers_destination_directory_subdir "${_vtk_install_headers_directory}" DIRECTORY)
4144 DIRECTORY "${_vtk_install_headers_directory}"
4145 DESTINATION "${_vtk_install_headers_destination}/${_vtk_install_headers_destination_directory_subdir}"
4146 COMPONENT "${_vtk_install_headers_headers_component}")
4151@ingroup module-internal
4152@brief Apply properties to a module
4154Apply build properties to a target. Generally only useful to wrapping code or
4155other modules that cannot use @ref vtk_module_add_module for some reason.
4158_vtk_module_apply_properties(<target>
4159 [BASENAME <basename>])
4162If `BASENAME` is given, it will be used instead of the target name as the basis
4163for `OUTPUT_NAME`. Full modules (as opposed to third party or other non-module
4164libraries) always use the module's `LIBRARY_NAME` setting.
4166The following
target properties are set based on the arguments to the calling
4169 - `OUTPUT_NAME` (based on the module
's `LIBRARY_NAME` and
4170 `vtk_module_build(LIBRARY_NAME_SUFFIX)`)
4171 - `VERSION` (based on `vtk_module_build(VERSION)`)
4172 - `SOVERSION` (based on `vtk_module_build(SOVERSION)`)
4173 - `DEBUG_POSTFIX` (on Windows unless already set via `CMAKE_DEBUG_POSTFIX`)
4175function (_vtk_module_apply_properties target)
4176 cmake_parse_arguments(PARSE_ARGV 1 _vtk_apply_properties
4181 if (_vtk_apply_properties_UNPARSED_ARGUMENTS)
4183 "Unparsed arguments for _vtk_module_apply_properties: "
4184 "${_vtk_apply_properties_UNPARSED_ARGUMENTS}.")
4187 if (NOT DEFINED _vtk_apply_properties_BASENAME)
4188 set(_vtk_apply_properties_BASENAME "${target}")
4191 get_property(_vtk_add_module_type
4194 if (_vtk_add_module_type STREQUAL "OBJECT_LIBRARY" OR
4195 _vtk_add_module_type STREQUAL "INTERFACE_LIBRARY")
4199 set(_vtk_add_module_library_name "${_vtk_apply_properties_BASENAME}")
4200 get_property(_vtk_add_module_target_name GLOBAL
4201 PROPERTY "_vtk_module_${_vtk_build_module}_target_name")
4202 if (_vtk_add_module_target_name STREQUAL "${target}")
4203 get_property(_vtk_add_module_library_name GLOBAL
4204 PROPERTY "_vtk_module_${_vtk_build_module}_library_name")
4206 set(_vtk_add_module_output_name "${_vtk_add_module_library_name}${_vtk_add_module_LIBRARY_NAME_SUFFIX}")
4207 if (_vtk_build_LIBRARY_NAME_SUFFIX)
4208 string(APPEND _vtk_add_module_output_name "-${_vtk_build_LIBRARY_NAME_SUFFIX}")
4211 set_target_properties("${target}"
4213 OUTPUT_NAME "${_vtk_add_module_output_name}")
4215 if (_vtk_build_VERSION AND NOT _vtk_add_module_type STREQUAL "EXECUTABLE")
4216 set_target_properties("${target}"
4218 VERSION "${_vtk_build_VERSION}")
4221 if (_vtk_build_SOVERSION)
4222 set_target_properties("${target}"
4224 SOVERSION "${_vtk_build_SOVERSION}")
4227 if (WIN32 AND NOT DEFINED CMAKE_DEBUG_POSTFIX)
4228 set_target_properties("${target}"
4234 if (NOT _vtk_add_module_type STREQUAL "EXECUTABLE")
4235 set_property(TARGET "${target}"
4237 BUILD_RPATH_USE_ORIGIN 1)
4240 set(_vtk_build_origin_rpath_prefix
4243 set(_vtk_build_origin_rpath_prefix
4247 set_property(TARGET "${target}" APPEND
4249 INSTALL_RPATH "${_vtk_build_origin_rpath_prefix}")
4255@ingroup module-internal
4256@brief Install a module target
4258Install a target within the module context. Generally only useful to wrapping
4259code, modules that cannot use @ref vtk_module_add_module for some reason, or
4260modules which create utility targets that need installed.
4263_vtk_module_install(<target>)
4266This function uses the various installation options to @ref vtk_module_build
4267function to keep the install uniform.
4269function (_vtk_module_install target)
4270 set(_vtk_install_export)
4271 if (_vtk_build_INSTALL_EXPORT)
4272 list(APPEND _vtk_install_export
4273 EXPORT "${_vtk_build_INSTALL_EXPORT}")
4276 set(_vtk_install_headers_component "${_vtk_build_HEADERS_COMPONENT}")
4277 set(_vtk_install_targets_component "${_vtk_build_TARGETS_COMPONENT}")
4278 if (_vtk_build_TARGET_SPECIFIC_COMPONENTS)
4280 string(PREPEND _vtk_install_headers_component "${_vtk_build_kit}-")
4281 string(PREPEND _vtk_install_targets_component "${_vtk_build_kit}-")
4283 string(PREPEND _vtk_install_headers_component "${_vtk_build_module}-")
4284 string(PREPEND _vtk_install_targets_component "${_vtk_build_module}-")
4285 if (_vtk_build_BUILD_WITH_KITS)
4286 get_property(_vtk_install_kit GLOBAL
4287 PROPERTY "_vtk_module_${_vtk_build_module}_kit")
4288 if (_vtk_install_kit)
4289 set(_vtk_install_headers_component "${_vtk_install_kit}-${_vtk_build_HEADERS_COMPONENT}")
4290 set(_vtk_install_targets_component "${_vtk_install_kit}-${_vtk_build_TARGETS_COMPONENT}")
4298 ${_vtk_install_export}
4301 DESTINATION "${_vtk_build_ARCHIVE_DESTINATION}"
4302 COMPONENT "${_vtk_install_targets_component}"
4304 DESTINATION "${_vtk_build_LIBRARY_DESTINATION}"
4305 COMPONENT "${_vtk_install_targets_component}"
4306 NAMELINK_COMPONENT "${_vtk_build_HEADERS_COMPONENT}"
4308 DESTINATION "${_vtk_build_RUNTIME_DESTINATION}"
4309 COMPONENT "${_vtk_install_targets_component}")
4314@brief Create a module executable
4316Some modules may have associated executables with them. By using this function,
4317the target will be installed following the options given to the associated
4318@ref vtk_module_build command. Its name will also be changed according to the
4319`LIBRARY_NAME_SUFFIX` option.
4322vtk_module_add_executable(<name>
4325 [BASENAME <basename>]
4329If `NO_INSTALL` is specified, the executable will not be installed. If
4330`BASENAME` is given, it will be used as the name of the executable rather than
4333If `DEVELOPMENT` is given, it marks the executable as a development tool and
4334will not be installed if `INSTALL_HEADERS` is not set for the associated
4335@ref vtk_module_build command.
4337If the executable being built is the module, its module properties are used
4338rather than `BASENAME`. In addition, the dependencies of the module will be
4341function (vtk_module_add_executable name)
4342 cmake_parse_arguments(PARSE_ARGV 1 _vtk_add_executable
4343 "NO_INSTALL;DEVELOPMENT"
4347 if (NOT _vtk_add_executable_UNPARSED_ARGUMENTS)
4349 "The ${name} executable must have at least one source file.")
4352 if (_vtk_add_executable_NO_INSTALL AND _vtk_add_executable_DEVELOPMENT)
4354 "Both `NO_INSTALL` and `DEVELOPMENT` may not be specified.")
4357 set(_vtk_add_executable_target_name "${name}")
4358 set(_vtk_add_executable_library_name "${name}")
4359 if (name STREQUAL _vtk_build_module)
4360 if (_vtk_add_executable_NO_INSTALL)
4362 "The executable ${_vtk_build_module} module may not use `NO_INSTALL`.")
4364 if (DEFINED _vtk_add_executable_BASENAME)
4366 "The executable ${_vtk_build_module} module may not pass `BASENAME` "
4367 "when adding the executable; it is controlled via `LIBRARY_NAME` in "
4368 "the associated `vtk.module` file.")
4370 get_property(_vtk_add_executable_target_name GLOBAL
4371 PROPERTY "_vtk_module_${_vtk_build_module}_target_name")
4372 get_property(_vtk_add_executable_library_name GLOBAL
4373 PROPERTY "_vtk_module_${_vtk_build_module}_library_name")
4376 if (_vtk_add_executable_DEVELOPMENT AND NOT _vtk_build_INSTALL_HEADERS)
4377 set(_vtk_add_executable_NO_INSTALL ON)
4381 set(CMAKE_BUILD_RPATH_USE_ORIGIN 1)
4383 file(RELATIVE_PATH _vtk_add_executable_relpath
4384 "/prefix/${_vtk_build_RUNTIME_DESTINATION}"
4385 "/prefix/${_vtk_build_LIBRARY_DESTINATION}")
4387 set(_vtk_add_executable_origin_rpath_prefix
4390 set(_vtk_add_executable_origin_rpath_prefix
4394 list(APPEND CMAKE_INSTALL_RPATH
4395 "${_vtk_add_executable_origin_rpath_prefix}/${_vtk_add_executable_relpath}")
4398 add_executable("${_vtk_add_executable_target_name}"
4399 ${_vtk_add_executable_UNPARSED_ARGUMENTS})
4401 if (name STREQUAL _vtk_build_module AND NOT _vtk_add_executable_target_name STREQUAL _vtk_build_module)
4402 add_executable("${_vtk_build_module}" ALIAS
4403 "${_vtk_add_executable_target_name}")
4406 if (name STREQUAL _vtk_build_module)
4407 get_property(_vtk_real_target_kit GLOBAL
4408 PROPERTY "_vtk_module_${_vtk_build_module}_kit")
4409 if (_vtk_real_target_kit)
4411 "Executable module ${_vtk_build_module} is declared to be part of a "
4412 "kit; this is not possible.")
4415 get_property(_vtk_add_executable_depends GLOBAL
4416 PROPERTY "_vtk_module_${_vtk_build_module}_depends")
4417 get_property(_vtk_add_executable_private_depends GLOBAL
4418 PROPERTY "_vtk_module_${_vtk_build_module}_private_depends")
4419 target_link_libraries("${_vtk_add_executable_target_name}"
4421 ${_vtk_add_executable_depends}
4423 ${_vtk_add_executable_private_depends})
4424 get_property(_vtk_add_executable_optional_depends GLOBAL
4425 PROPERTY "_vtk_module_${_vtk_build_module}_optional_depends")
4426 foreach (_vtk_add_executable_optional_depend IN LISTS _vtk_add_executable_optional_depends)
4427 string(REPLACE "::" "_" _vtk_add_executable_optional_depend_safe "${_vtk_add_executable_optional_depend}")
4428 target_compile_definitions("${_vtk_add_executable_target_name}"
4430 "VTK_MODULE_ENABLE_${_vtk_add_executable_optional_depend_safe}=$<TARGET_EXISTS:{_vtk_add_executable_optional_depend}>")
4433 if (_vtk_module_warnings)
4434 if (_vtk_add_executable_depends)
4436 "Executable module ${_vtk_build_module} has public dependencies; this "
4437 "shouldn't be necessary.
")
4442 if (_vtk_build_UTILITY_TARGET)
4443 target_link_libraries("${_vtk_add_executable_target_name}
"
4445 "${_vtk_build_UTILITY_TARGET}
")
4448 set(_vtk_add_executable_property_args)
4449 if (DEFINED _vtk_add_executable_BASENAME)
4450 list(APPEND _vtk_add_executable_property_args
4451 BASENAME "${_vtk_add_executable_BASENAME}
")
4454 _vtk_module_apply_properties("${_vtk_add_executable_target_name}
"
4455 ${_vtk_add_executable_property_args})
4456 _vtk_module_standard_includes(TARGET "${_vtk_add_executable_target_name}
")
4458 if (NOT _vtk_add_executable_NO_INSTALL)
4459 _vtk_module_install("${_vtk_add_executable_target_name}
")
4465@brief Find a package
4467A wrapper around `find_package` that records information for use so that the
4468same targets may be found when finding this package.
4470Modules may need to find external dependencies. CMake often provides modules to
4471find these dependencies, but when imported targets are involved, these.need to
4472also be found from dependencies of the current project. Since the benefits of
4473imported targets greatly outweighs not using them, it is preferred to use them.
4475The module system provides the @ref vtk_module_find_package function in order
4476to extend `find_package` support to include finding the dependencies from an
4477install of the project.
4480vtk_module_find_package(
4481 [PRIVATE] [CONFIG_MODE]
4484 [COMPONENTS <component>...]
4485 [OPTIONAL_COMPONENTS <component>...]
4486 [FORWARD_VERSION_REQ <MAJOR|MINOR|PATCH|EXACT>]
4487 [VERSION_VAR <variable>])
4490 * `PACKAGE`: The name of the package to find.
4491 * `VERSION`: The minimum version of the package that is required.
4492 * `COMPONENTS`: Components of the package which are required.
4493 * `OPTIONAL_COMPONENTS`: Components of the package which may be missing.
4494 * `FORWARD_VERSION_REQ`: If provided, the found version will be promoted to
4495 the minimum version required matching the given version scheme.
4496 * `VERSION_VAR`: The variable to use as the provided version (defaults to
4497 `<PACKAGE>_VERSION`). It may contain `@` in which case it will be
4498 configured. This is useful for modules which only provide components of the
4499 actual version number.
4500 * `CONFIG_MODE`: If present, pass `CONFIG` to the underlying `find_package`
4502 * `PRIVATE`: The dependency should not be exported to the install.
4504The `PACKAGE` argument is the only required argument. The rest are optional.
4506Note that `PRIVATE` is *only* applicable for private dependencies on interface
4507targets (basically, header libraries) because some platforms require private
4508shared libraries dependencies to be present when linking dependent libraries
4509and executables as well. Such usages should additionally be used only via a
4510`$<BUILD_INTERFACE>` generator expression to avoid putting the target name into
4511the install tree at all.
4513macro (vtk_module_find_package)
4514 # This needs to be a macro because find modules typically set variables which
4515 # may need to be available in the calling scope. If we declare that it only
4516 # works with imported targets (which is the primary motivating factor behind
4517 # this function), we can instead make it a function at the cost of any
4518 # non-target variables a module might want to set being available. It is
4519 # unlikely that this will be the case for all callers.
4520 if (NOT _vtk_build_module)
4526 # Note: when adding arguments here, add them to the `unset` block at the end
4528 cmake_parse_arguments(_vtk_find_package
4529 "PRIVATE;CONFIG_MODE
"
4530 "PACKAGE;VERSION;FORWARD_VERSION_REQ;VERSION_VAR
"
4531 "COMPONENTS;OPTIONAL_COMPONENTS
"
4534 if (_vtk_find_package_UNPARSED_ARGUMENTS)
4537 "${_vtk_find_package_UNPARSED_ARGUMENTS}
")
4540 if (NOT DEFINED _vtk_find_package_PACKAGE)
4542 "The `PACKAGE` argument is required.
")
4545 if (DEFINED _vtk_find_package_FORWARD_VERSION_REQ)
4546 if (_vtk_find_package_PRIVATE)
4548 "The `FORWARD_VERSION_REQ` argument is incompatible with the
"
4552 if (NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MAJOR
" AND
4553 NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MINOR
" AND
4554 NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "PATCH
" AND
4555 NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "EXACT
")
4557 "The `FORWARD_VERSION_REQ` argument must be one of `MAJOR`, `MINOR`,
"
4558 "`PATCH`, or `EXACT`.
")
4562 if (NOT DEFINED _vtk_find_package_VERSION_VAR)
4563 set(_vtk_find_package_VERSION_VAR
4564 "${_vtk_find_package_PACKAGE}_VERSION
")
4567 set(_vtk_find_package_config)
4568 if (_vtk_find_package_CONFIG_MODE)
4569 set(_vtk_find_package_config "CONFIG
")
4572 find_package("${_vtk_find_package_PACKAGE}
"
4573 ${_vtk_find_package_VERSION}
4574 ${_vtk_find_package_config}
4575 COMPONENTS ${_vtk_find_package_COMPONENTS}
4576 OPTIONAL_COMPONENTS ${_vtk_find_package_OPTIONAL_COMPONENTS})
4577 if (NOT ${_vtk_find_package_PACKAGE}_FOUND)
4579 "Could not find the ${_vtk_find_package_PACKAGE} external dependency.
")
4583 set(_vtk_find_package_optional_components_found)
4584 foreach (_vtk_find_package_optional_component IN LISTS _vtk_find_package_OPTIONAL_COMPONENTS)
4585 if (${_vtk_find_package_PACKAGE}_${_vtk_find_package_optional_component}_FOUND)
4586 list(APPEND _vtk_find_package_optional_components_found
4587 "${_vtk_find_package_optional_component}
")
4591 set_property(GLOBAL APPEND
4593 "_vtk_module_find_packages_${_vtk_build_PACKAGE}
" "${_vtk_find_package_PACKAGE}
")
4594 set(_vtk_find_package_base "_vtk_module_find_package_${_vtk_build_module}
")
4595 set_property(GLOBAL APPEND
4597 "${_vtk_find_package_base}
" "${_vtk_find_package_PACKAGE}
")
4598 set(_vtk_find_package_base_package "${_vtk_find_package_base}_${_vtk_find_package_PACKAGE}
")
4601 "${_vtk_find_package_base_package}_private
" "${_vtk_find_package_PRIVATE}
")
4604 "${_vtk_find_package_base_package}_version
" "${_vtk_find_package_VERSION}
")
4607 "${_vtk_find_package_base_package}_config
" "${_vtk_find_package_CONFIG_MODE}
")
4608 set_property(GLOBAL APPEND
4610 "${_vtk_find_package_base_package}_components
" "${_vtk_find_package_COMPONENTS}
")
4611 set_property(GLOBAL APPEND
4613 "${_vtk_find_package_base_package}_optional_components
" "${_vtk_find_package_OPTIONAL_COMPONENTS}
")
4614 set_property(GLOBAL APPEND
4616 "${_vtk_find_package_base_package}_optional_components_found
" "${_vtk_find_package_optional_components_found}
")
4619 "${_vtk_find_package_base_package}_exact
" "0
")
4620 if (DEFINED _vtk_find_package_FORWARD_VERSION_REQ)
4621 string(FIND "${_vtk_find_package_VERSION_VAR}
" "@" _vtk_find_package_idx)
4622 if (_vtk_find_package_idx EQUAL -1)
4623 if (NOT DEFINED "${_vtk_find_package_VERSION_VAR}
")
4625 "The `${_vtk_find_package_VERSION_VAR}` variable is not defined.
")
4627 set(_vtk_find_package_version "${${_vtk_find_package_VERSION_VAR}}
")
4629 string(CONFIGURE "${_vtk_find_package_VERSION_VAR}
" _vtk_find_package_version)
4631 unset(_vtk_find_package_idx)
4633 if ("${_vtk_find_package_version}
" STREQUAL "")
4635 "The `${_vtk_find_package_PACKAGE}`
version is empty.
")
4638 if (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MAJOR
")
4639 set(_vtk_find_package_version_regex "^\([^.]*\).*
")
4640 elseif (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MINOR
")
4641 set(_vtk_find_package_version_regex "^\([^.]*.[^.]*\).*
")
4642 elseif (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "PATCH
")
4643 set(_vtk_find_package_version_regex "^\([^.]*.[^.]*.[^.]*\).*
")
4644 elseif (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "EXACT
")
4645 set(_vtk_find_package_version_regex "^\\(.*\\)$
")
4648 "${_vtk_find_package_base_package}_exact
" "1
")
4651 string(REGEX REPLACE "${_vtk_find_package_version_regex}
" "\\1
"
4652 _vtk_find_package_found_version "${_vtk_find_package_version}
")
4653 unset(_vtk_find_package_version_regex)
4654 unset(_vtk_find_package_version)
4658 "${_vtk_find_package_base_package}_version
" "${_vtk_find_package_found_version}
")
4659 unset(_vtk_find_package_found_version)
4662 unset(_vtk_find_package_base)
4663 unset(_vtk_find_package_base_package)
4664 unset(_vtk_find_package_COMPONENTS)
4665 unset(_vtk_find_package_FORWARD_VERSION_REQ)
4666 unset(_vtk_find_package_OPTIONAL_COMPONENTS)
4667 unset(_vtk_find_package_PACKAGE)
4668 unset(_vtk_find_package_PRIVATE)
4669 unset(_vtk_find_package_UNPARSED_ARGUMENTS)
4670 unset(_vtk_find_package_VERSION)
4671 unset(_vtk_find_package_VERSION_VAR)
4676@brief Export find_package calls for dependencies
4678When installing a project that is meant to be found via `find_package` from
4679CMake, using imported targets in the build means that imported targets need to
4680be created during the `find_package` as well. This function writes a file
4681suitable for inclusion from a `<package>-config.cmake` file to satisfy
4682dependencies. It assumes that the exported targets are named
4683`${CMAKE_FIND_PACKAGE_NAME}::${component}`. Dependent packages will only be
4684found if a requested component requires the package to be found either directly
4688vtk_module_export_find_packages(
4689 CMAKE_DESTINATION <directory>
4690 FILE_NAME <filename>
4691 [COMPONENT <component>]
4692 MODULES <module>...)
4695The file will be named according to the `FILE_NAME` argument will be installed
4696into `CMAKE_DESTINATION` in the build and install trees with the given
4697filename. If not provided, the `development` component will be used.
4699The `vtk_module_find_package` calls made by the modules listed in `MODULES`
4700will be exported to this file.
4702function (vtk_module_export_find_packages)
4703 cmake_parse_arguments(PARSE_ARGV 0 _vtk_export
4705 "CMAKE_DESTINATION;FILE_NAME;COMPONENT
"
4708 if (_vtk_export_UNPARSED_ARGUMENTS)
4711 "${_vtk_export_UNPARSED_ARGUMENTS}
")
4714 if (NOT DEFINED _vtk_export_CMAKE_DESTINATION)
4716 "The `CMAKE_DESTINATION` is required.
")
4719 if (NOT DEFINED _vtk_export_FILE_NAME)
4721 "The `FILE_NAME` is required.
")
4724 if (NOT DEFINED _vtk_export_COMPONENT)
4725 set(_vtk_export_COMPONENT "development
")
4728 set(_vtk_export_prelude
4729"set(_vtk_module_find_package_quiet)
4730if (\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
4731 set(_vtk_module_find_package_quiet QUIET)
4734set(_vtk_module_find_package_components_checked)
4735set(_vtk_module_find_package_components_to_check
4736 \${\${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS})
4737set(_vtk_module_find_package_components)
4738set(_vtk_module_find_package_components_required)
4739while (_vtk_module_find_package_components_to_check)
4740 list(GET _vtk_module_find_package_components_to_check 0 _vtk_module_component)
4741 list(REMOVE_AT _vtk_module_find_package_components_to_check 0)
4742 if (_vtk_module_component IN_LIST _vtk_module_find_package_components_checked)
4745 list(APPEND _vtk_module_find_package_components_checked
4746 \
"\${_vtk_module_component}\")
4748 list(APPEND _vtk_module_find_package_components
4749 \"\${_vtk_module_component}\")
4750 if (\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_\${_vtk_module_component})
4751 list(APPEND _vtk_module_find_package_components_required
4752 \"\${_vtk_module_component}\")
4755 if (TARGET \"\${CMAKE_FIND_PACKAGE_NAME}::\${_vtk_module_component}\")
4756 set(_vtk_module_find_package_component_target \"\${CMAKE_FIND_PACKAGE_NAME}::\${_vtk_module_component}\")
4757 elseif (TARGET \"\${_vtk_module_component}\")
4758 set(_vtk_module_find_package_component_target \"\${_vtk_module_component}\")
4760 # No such target for the component; skip.
4763 get_property(_vtk_module_find_package_depends
4764 TARGET \"\${_vtk_module_find_package_component_target}\"
4765 PROPERTY \"INTERFACE_vtk_module_depends\")
4766 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depends \"\${_vtk_module_find_package_depends}\")
4767 list(APPEND _vtk_module_find_package_components_to_check
4768 \${_vtk_module_find_package_depends})
4769 get_property(_vtk_module_find_package_depends
4770 TARGET \"\${_vtk_module_find_package_component_target}\"
4771 PROPERTY \"INTERFACE_vtk_module_private_depends\")
4772 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depends \"\${_vtk_module_find_package_depends}\")
4773 list(APPEND _vtk_module_find_package_components_to_check
4774 \${_vtk_module_find_package_depends})
4775 get_property(_vtk_module_find_package_depends
4776 TARGET \"\${_vtk_module_find_package_component_target}\"
4777 PROPERTY \"INTERFACE_vtk_module_optional_depends\")
4778 foreach (_vtk_module_find_package_depend IN LISTS _vtk_module_find_package_depends)
4779 if (TARGET \"\${_vtk_module_find_package_depend}\")
4780 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depend \"\${_vtk_module_find_package_depend}\")
4781 list(APPEND _vtk_module_find_package_components_to_check
4782 \"\${_vtk_module_find_package_depend}\")
4785 get_property(_vtk_module_find_package_depends
4786 TARGET \"\${_vtk_module_find_package_component_target}\"
4787 PROPERTY \"INTERFACE_vtk_module_forward_link\")
4788 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depends \"\${_vtk_module_find_package_depends}\")
4789 list(APPEND _vtk_module_find_package_components_to_check
4790 \${_vtk_module_find_package_depends})
4792 get_property(_vtk_module_find_package_kit
4793 TARGET \"\${_vtk_module_find_package_component_target}\"
4794 PROPERTY \"INTERFACE_vtk_module_kit\")
4795 if (_vtk_module_find_package_kit)
4796 get_property(_vtk_module_find_package_kit_modules
4797 TARGET \"\${_vtk_module_find_package_kit}\"
4798 PROPERTY \"INTERFACE_vtk_kit_kit_modules\")
4799 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_kit_modules \"\${_vtk_module_find_package_kit_modules}\")
4800 list(APPEND _vtk_module_find_package_components_to_check
4801 \${_vtk_module_find_package_kit_modules})
4804unset(_vtk_module_find_package_component_target)
4805unset(_vtk_module_find_package_components_to_check)
4806unset(_vtk_module_find_package_components_checked)
4807unset(_vtk_module_component)
4808unset(_vtk_module_find_package_depend)
4809unset(_vtk_module_find_package_depends)
4810unset(_vtk_module_find_package_kit)
4811unset(_vtk_module_find_package_kit_modules)
4813if (_vtk_module_find_package_components)
4814 list(REMOVE_DUPLICATES _vtk_module_find_package_components)
4816if (_vtk_module_find_package_components_required)
4817 list(REMOVE_DUPLICATES _vtk_module_find_package_components_required)
4820 set(_vtk_export_build_content)
4821 set(_vtk_export_install_content)
4822 foreach (_vtk_export_module IN LISTS _vtk_export_MODULES)
4823 get_property(_vtk_export_target_name GLOBAL
4824 PROPERTY
"_vtk_module_${_vtk_export_module}_target_name")
4825 # Use the export name of the target if it has one set.
4826 get_property(_vtk_export_target_has_export_name
4827 TARGET
"${_vtk_export_target_name}"
4828 PROPERTY EXPORT_NAME SET)
4829 if (_vtk_export_target_has_export_name)
4830 get_property(_vtk_export_target_name
4831 TARGET
"${_vtk_export_target_name}"
4832 PROPERTY EXPORT_NAME)
4834 set(_vtk_export_base
"_vtk_module_find_package_${_vtk_export_module}")
4835 get_property(_vtk_export_packages GLOBAL
4836 PROPERTY
"${_vtk_export_base}")
4837 if (NOT _vtk_export_packages)
4841 set(_vtk_export_module_prelude
4842"set(_vtk_module_find_package_enabled OFF)
4843set(_vtk_module_find_package_is_required OFF)
4844set(_vtk_module_find_package_fail_if_not_found OFF)
4845if (_vtk_module_find_package_components)
4846 if (\"${_vtk_export_target_name}\" IN_LIST _vtk_module_find_package_components)
4847 set(_vtk_module_find_package_enabled ON)
4848 if (\"${_vtk_export_target_name}\" IN_LIST _vtk_module_find_package_components_required)
4849 set(_vtk_module_find_package_is_required \"\${\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED}\")
4850 set(_vtk_module_find_package_fail_if_not_found ON)
4854 set(_vtk_module_find_package_enabled ON)
4855 set(_vtk_module_find_package_is_required \"\${\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED}\")
4856 set(_vtk_module_find_package_fail_if_not_found ON)
4859if (_vtk_module_find_package_enabled)
4860 set(_vtk_module_find_package_required)
4861 if (_vtk_module_find_package_is_required)
4862 set(_vtk_module_find_package_required REQUIRED)
4865 list(REMOVE_DUPLICATES _vtk_export_packages)
4866 set(_vtk_export_module_build_content)
4867 set(_vtk_export_module_install_content)
4868 foreach (_vtk_export_package IN LISTS _vtk_export_packages)
4869 set(_vtk_export_base_package
"${_vtk_export_base}_${_vtk_export_package}")
4870 get_property(_vtk_export_private GLOBAL
4871 PROPERTY
"${_vtk_export_base_package}_private")
4872 get_property(_vtk_export_version GLOBAL
4873 PROPERTY
"${_vtk_export_base_package}_version")
4874 get_property(_vtk_export_config GLOBAL
4875 PROPERTY
"${_vtk_export_base_package}_config")
4876 get_property(_vtk_export_exact GLOBAL
4877 PROPERTY
"${_vtk_export_base_package}_exact")
4878 get_property(_vtk_export_components GLOBAL
4879 PROPERTY
"${_vtk_export_base_package}_components")
4880 get_property(_vtk_export_optional_components GLOBAL
4881 PROPERTY
"${_vtk_export_base_package}_optional_components")
4882 get_property(_vtk_export_optional_components_found GLOBAL
4883 PROPERTY
"${_vtk_export_base_package}_optional_components_found")
4885 # Assume that any found optional components end up being required.
4886 if (${_vtk_export_base_package}_optional_components_found)
4887 list(REMOVE_ITEM _vtk_export_optional_components
4888 ${_vtk_export_optional_components_found})
4889 list(APPEND _vtk_export_components
4890 ${_vtk_export_optional_components_found})
4893 set(_vtk_export_config_arg)
4894 if (_vtk_export_config)
4895 set(_vtk_export_config_arg CONFIG)
4898 set(_vtk_export_exact_arg)
4899 if (_vtk_export_exact)
4900 set(_vtk_export_exact_arg EXACT)
4903 set(_vtk_export_module_content
4904" find_package(${_vtk_export_package}
4905 ${_vtk_export_version}
4906 ${_vtk_export_exact_arg}
4907 ${_vtk_export_config_arg}
4908 \${_vtk_module_find_package_quiet}
4909 \${_vtk_module_find_package_required}
4910 COMPONENTS ${_vtk_export_components}
4911 OPTIONAL_COMPONENTS ${_vtk_export_optional_components})
4912 if (NOT ${_vtk_export_package}_FOUND AND _vtk_module_find_package_fail_if_not_found)
4913 if (NOT \${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
4915 \"Could not find the \${CMAKE_FIND_PACKAGE_NAME} package due to a \"
4916 \"missing dependency: ${_vtk_export_package}\")
4918 set(\"\${CMAKE_FIND_PACKAGE_NAME}_${_vtk_export_target_name}_FOUND\" 0)
4919 list(APPEND \"\${CMAKE_FIND_PACKAGE_NAME}_${_vtk_export_target_name}_NOT_FOUND_MESSAGE\"
4920 \"Failed to find the ${_vtk_export_package} package.\")
4923 string(APPEND _vtk_export_module_build_content
"${_vtk_export_module_content}")
4924 # Private usages should be guarded by `$<BUILD_INTERFACE>` and can be
4925 # skipped for the install tree regardless of the build mode.
4926 if (NOT _vtk_export_private)
4927 string(APPEND _vtk_export_module_install_content
"${_vtk_export_module_content}")
4931 set(_vtk_export_module_trailer
4934unset(_vtk_module_find_package_fail_if_not_found)
4935unset(_vtk_module_find_package_enabled)
4936unset(_vtk_module_find_package_required)\n\n")
4938 if (_vtk_export_module_build_content)
4939 string(APPEND _vtk_export_build_content
4940 "${_vtk_export_module_prelude}${_vtk_export_module_build_content}${_vtk_export_module_trailer}")
4942 if (_vtk_export_module_install_content)
4943 string(APPEND _vtk_export_install_content
4944 "${_vtk_export_module_prelude}${_vtk_export_module_install_content}${_vtk_export_module_trailer}")
4948 set(_vtk_export_trailer
4949 "unset(_vtk_module_find_package_components)
4950unset(_vtk_module_find_package_components_required)
4951unset(_vtk_module_find_package_quiet)\n")
4953 set(_vtk_export_build_file
4954 "${CMAKE_BINARY_DIR}/${_vtk_export_CMAKE_DESTINATION}/${_vtk_export_FILE_NAME}")
4955 set(_vtk_export_install_file
4956 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_export_FILE_NAME}.install")
4957 if (_vtk_export_build_content)
4958 file(WRITE
"${_vtk_export_build_file}"
4959 "${_vtk_export_prelude}${_vtk_export_build_content}${_vtk_export_trailer}")
4961 file(WRITE
"${_vtk_export_build_file}" "")
4963 if (_vtk_export_install_content)
4964 file(WRITE
"${_vtk_export_install_file}"
4965 "${_vtk_export_prelude}${_vtk_export_install_content}${_vtk_export_trailer}")
4967 file(WRITE
"${_vtk_export_install_file}" "")
4971 FILES
"${_vtk_export_install_file}"
4972 DESTINATION
"${_vtk_export_CMAKE_DESTINATION}"
4973 RENAME
"${_vtk_export_FILE_NAME}"
4974 COMPONENT
"${_vtk_export_COMPONENT}")
4978@page module-overview
4981@section module-third-party Third party support
4983The module system acknowledges that third party support is a pain and offers
4984APIs to help wrangle them. Sometimes third party code needs a shim introduced
4985to make it behave better, so an `INTERFACE` library to add that in is very
4986useful. Other times, third party code is hard to ensure that it exists
4987everywhere, so it is bundled. When that happens, the ability to select between
4988the bundled copy and an external copy is useful. All three (and more) of these
4991The following functions are used to handle third party modules:
5000@brief Third party module
5002When a project has modules which represent third party packages, there are some
5003convenience functions to help deal with them. First, there is the meta-wrapper:
5007 [INTERNAL <internal arguments>...]
5008 [EXTERNAL <external arguments>...])
5011This offers a cache variable named `VTK_MODULE_USE_EXTERNAL_<module name>` that
5012may be set to trigger between the
internal copy and an externally provided
5013copy. This is available as a local variable named
5014`VTK_MODULE_USE_EXTERNAL_<library name>`. See the
5016functions
for the arguments supported by the `EXTERNAL` and `INTERNAL`
5017arguments, respectively.
5020 cmake_parse_arguments(PARSE_ARGV 0 _vtk_third_party
5023 "INTERNAL;EXTERNAL")
5025 if (_vtk_third_party_UNPARSED_ARGUMENTS)
5027 "Unparsed arguments for vtk_module_third_party: "
5028 "${_vtk_third_party_UNPARSED_ARGUMENTS}")
5031 string(REPLACE
"::" "_" _vtk_build_module_safe
"${_vtk_build_module}")
5032 option(
"VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe}"
5033 "Use externally provided ${_vtk_build_module}"
5034 "${_vtk_build_USE_EXTERNAL}")
5035 mark_as_advanced(
"VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe}")
5036 get_property(_vtk_third_party_library_name GLOBAL
5037 PROPERTY
"_vtk_module_${_vtk_build_module}_library_name")
5038 set(
"VTK_MODULE_USE_EXTERNAL_${_vtk_third_party_library_name}"
5039 "${VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe}}"
5042 if (VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe})
5045 # Bubble up variables again.
5046 foreach (_vtk_third_party_variable IN LISTS _vtk_third_party_variables)
5047 set(
"${_vtk_third_party_variable}"
5048 "${${_vtk_third_party_variable}}"
5052 set(_vtk_third_party_has_external_support 1)
5059@brief Mark a module as being third party
5061Mark a module as being a third party module.
5064_vtk_module_mark_third_party(<
target>)
5068 # TODO: `_vtk_module_set_module_property` instead.
5069 set_target_properties(
"${target}"
5071 "INTERFACE_vtk_module_exclude_wrap" 1
5072 "INTERFACE_vtk_module_third_party" 1)
5077@brief External third party
package
5079A third party dependency may be expressed as a module using this function.
5080Third party packages are found using CMake's `find_package` function. It is
5081highly recommended that imported targets are used to make usage easier. The
5082module itself will be created as an `INTERFACE` library which exposes the
5086vtk_module_third_party_external(
5089 [COMPONENTS <component>...]
5090 [OPTIONAL_COMPONENTS <component>...]
5091 [TARGETS <target>...]
5092 [INCLUDE_DIRS <path-or-variable>...]
5093 [LIBRARIES <target-or-variable>...]
5094 [DEFINITIONS <variable>...]
5095 [FORWARD_VERSION_REQ <MAJOR|MINOR|PATCH|EXACT>]
5096 [VERSION_VAR <version-spec>]
5097 [USE_VARIABLES <variable>...]
5099 [STANDARD_INCLUDE_DIRS])
5102Only the `PACKAGE` argument is required. The arguments are as follows:
5104 * `PACKAGE`: (Required) The name of the package to find.
5105 * `VERSION`: If specified, the minimum version of the dependency that must be
5107 * `COMPONENTS`: The list of components to request from the package.
5108 * `OPTIONAL_COMPONENTS`: The list of optional components to request from the
5110 * `TARGETS`: The list of targets to search for when using this package.
5111 Targets which do not exist will be ignored to support different versions of
5112 a package using different target names.
5113 * `STANDARD_INCLUDE_DIRS`: If present, standard include directories will be
5114 added to the module target. This is usually only required if both internal
5115 and external are supported for a given dependency.
5116 * `INCLUDE_DIRS`: If specified, this is added as a `SYSTEM INTERFACE` include
5117 directory for the target. If a variable name is given, it will be
5119 * `LIBRARIES`: The libraries to link from the package. If a variable name is
5120 given, it will be dereferenced, however a warning that imported targets are
5121 not being used will be emitted.
5122 * `DEFINITIONS`: If specified, the given variables will be added to the
5123 target compile definitions interface.
5124 * `CONFIG_MODE`: Force `CONFIG` mode.
5125 * `FORWARD_VERSION_REQ` and `VERSION_VAR`: See documentation for
5126 @ref vtk_module_find_package.
5127 * `USE_VARIABLES`: List of variables from the `find_package` to make
5128 available to the caller.
5130function (vtk_module_third_party_external)
5131 cmake_parse_arguments(PARSE_ARGV 0 _vtk_third_party_external
5132 "STANDARD_INCLUDE_DIRS;CONFIG_MODE
"
5133 "VERSION;PACKAGE;FORWARD_VERSION_REQ;VERSION_VAR
"
5134 "COMPONENTS;OPTIONAL_COMPONENTS;LIBRARIES;INCLUDE_DIRS;DEFINITIONS;TARGETS;USE_VARIABLES
")
5136 if (_vtk_third_party_external_UNPARSED_ARGUMENTS)
5139 "${_vtk_third_party_external_UNPARSED_ARGUMENTS}
")
5142 get_property(_vtk_third_party_external_is_third_party GLOBAL
5143 PROPERTY "_vtk_module_${_vtk_build_module}_third_party
")
5144 if (NOT _vtk_third_party_external_is_third_party)
5146 "The ${_vtk_build_module} has not been declared as a third party
"
5150 if (NOT DEFINED _vtk_third_party_external_PACKAGE)
5152 "The `PACKAGE` argument is required.
")
5155 set(_vtk_third_party_external_args)
5156 if (DEFINED _vtk_third_party_external_FORWARD_VERSION_REQ)
5157 list(APPEND _vtk_third_party_external_args
5158 FORWARD_VERSION_REQ "${_vtk_third_party_external_FORWARD_VERSION_REQ}
")
5160 if (DEFINED _vtk_third_party_external_VERSION_VAR)
5161 list(APPEND _vtk_third_party_external_args
5162 VERSION_VAR "${_vtk_third_party_external_VERSION_VAR}
")
5165 if (_vtk_third_party_external_TARGETS)
5166 set(_vtk_third_party_external_config_mode)
5167 if (_vtk_third_party_external_CONFIG_MODE)
5168 set(_vtk_third_party_external_config_mode "CONFIG_MODE
")
5171 # If we have targets, they must be exported to the install as well.
5172 vtk_module_find_package(
5173 PACKAGE "${_vtk_third_party_external_PACKAGE}
"
5174 VERSION "${_vtk_third_party_external_VERSION}
"
5175 COMPONENTS ${_vtk_third_party_external_COMPONENTS}
5176 OPTIONAL_COMPONENTS ${_vtk_third_party_external_OPTIONAL_COMPONENTS}
5177 ${_vtk_third_party_external_config_mode}
5178 ${_vtk_third_party_external_args})
5180 set(_vtk_third_party_external_config)
5181 if (_vtk_third_party_external_CONFIG_MODE)
5182 set(_vtk_third_party_external_config "CONFIG
")
5185 # If there are no targets, the install uses strings and therefore does not
5186 # need to find the dependency again.
5187 find_package("${_vtk_third_party_external_PACKAGE}
"
5188 ${_vtk_third_party_external_VERSION}
5189 ${_vtk_third_party_external_config}
5190 COMPONENTS ${_vtk_third_party_external_COMPONENTS}
5191 OPTIONAL_COMPONENTS ${_vtk_third_party_external_OPTIONAL_COMPONENTS})
5194 get_property(_vtk_third_party_external_target_name GLOBAL
5195 PROPERTY "_vtk_module_${_vtk_build_module}_target_name
")
5197 # Check if an imported target of the same name already exists.
5198 set(_vtk_third_party_external_real_target_name
5199 "${_vtk_third_party_external_target_name}
")
5200 set(_vtk_third_party_external_using_mangled_name OFF)
5201 if (TARGET "${_vtk_third_party_external_target_name}
")
5202 # Ensure that the target collision comes from an imported target.
5203 get_property(_vtk_third_party_external_is_imported
5204 TARGET "${_vtk_third_party_external_target_name}
"
5206 if (NOT _vtk_third_party_external_is_imported)
5208 "It appears as though there is a conflicting
target named
"
5209 "`${_vtk_third_party_external_target_name}` expected to be used by
"
5210 "the `${_vtk_build_module}`
module already added to the build. This "
5211 "conflicts with the target name expected to be used by an external "
5212 "third party dependency.")
5215 # If it does, we need to have a module name that is not the same as this
5216 # one. Error out if this is detected.
5217 if (_vtk_build_module STREQUAL _vtk_third_party_external_target_name)
5219 "An imported target has the same name used by the module system for "
5220 "the facade of the external dependency for `${_vtk_build_module}`. "
5221 "This module must be either renamed or placed into a namespace.")
5224 # Mangle the internal name. The alias is the expected use case anyways and
5225 # since this is an INTERFACE target, there's nothing to break with respect
5226 # to `make $target` anyways.
5227 string(APPEND _vtk_third_party_external_real_target_name
5228 "_vtk_module_mangle")
5229 set_property(GLOBAL APPEND_STRING
5230 PROPERTY "_vtk_module_${_vtk_build_module}_target_name"
5231 "_vtk_module_mangle")
5232 set(_vtk_third_party_external_using_mangled_name ON)
5235 add_library("${_vtk_third_party_external_real_target_name}" INTERFACE)
5236 if (_vtk_third_party_external_using_mangled_name)
5237 set_property(TARGET "${_vtk_third_party_external_real_target_name}"
5239 EXPORT_NAME "${_vtk_third_party_external_target_name}")
5241 if (NOT _vtk_build_module STREQUAL _vtk_third_party_external_target_name)
5242 add_library("${_vtk_build_module}" ALIAS
5243 "${_vtk_third_party_external_real_target_name}")
5246 if (_vtk_third_party_external_STANDARD_INCLUDE_DIRS)
5247 _vtk_module_standard_includes(TARGET "${_vtk_third_party_external_real_target_name}"
5251 # Try to use targets if they're specified and available.
5252 set(_vtk_third_party_external_have_targets FALSE)
5253 set(_vtk_third_party_external_used_targets FALSE)
5254 if (_vtk_third_party_external_TARGETS)
5255 set(_vtk_third_party_external_have_targets TRUE)
5256 foreach (_vtk_third_party_external_target IN LISTS _vtk_third_party_external_TARGETS)
5257 if (TARGET "${_vtk_third_party_external_target}")
5258 target_link_libraries("${_vtk_third_party_external_real_target_name}"
5260 "${_vtk_third_party_external_target}")
5261 set(_vtk_third_party_external_used_targets TRUE)
5266 if (NOT _vtk_third_party_external_used_targets)
5267 if (NOT _vtk_third_party_external_have_targets)
5269 "A third party dependency for ${_vtk_build_module} was found externally "
5270 "using paths rather than targets; it is recommended to use imported
"
5271 "targets rather than find_library and such.
")
5274 set(_vtk_third_party_external_have_includes FALSE)
5275 foreach (_vtk_third_party_external_include_dir IN LISTS _vtk_third_party_external_INCLUDE_DIRS)
5276 if (DEFINED "${_vtk_third_party_external_include_dir}
")
5277 if (${_vtk_third_party_external_include_dir})
5278 set(_vtk_third_party_external_have_includes TRUE)
5280 target_include_directories("${_vtk_third_party_external_real_target_name}
" SYSTEM
5281 INTERFACE "${${_vtk_third_party_external_include_dir}}
")
5285 if (_vtk_third_party_external_have_targets AND
5286 NOT _vtk_third_party_external_have_includes)
5288 "A third party dependency
for ${_vtk_build_module} has external targets
"
5289 "which were not found and no `INCLUDE_DIRS` were found either.
"
5290 "Including
this module may not work.
")
5293 foreach (_vtk_third_party_external_define IN LISTS _vtk_third_party_external_DEFINITIONS)
5294 if (DEFINED "${_vtk_third_party_external_define}
")
5295 target_compile_definitions("${_vtk_third_party_external_real_target_name}
"
5296 INTERFACE "${${_vtk_third_party_external_define}}
")
5300 set(_vtk_third_party_external_have_libraries FALSE)
5301 foreach (_vtk_third_party_external_library IN LISTS _vtk_third_party_external_LIBRARIES)
5302 if (DEFINED "${_vtk_third_party_external_library}
")
5303 if (${_vtk_third_party_external_library})
5304 set(_vtk_third_party_external_have_libraries TRUE)
5306 target_link_libraries("${_vtk_third_party_external_real_target_name}
"
5307 INTERFACE "${${_vtk_third_party_external_library}}
")
5311 if (_vtk_third_party_external_have_targets AND
5312 NOT _vtk_third_party_external_have_libraries)
5314 "A third party dependency
for ${_vtk_build_module} has external targets
"
5315 "which were not found and no `LIBRARIES` were found either. Linking to
"
5316 "this this module may not work.
")
5320 if (DEFINED _vtk_third_party_external_USE_VARIABLES)
5321 # If we're called from `vtk_module_third_party`, the variables need bubbled
5323 if (DEFINED _vtk_third_party_EXTERNAL)
5324 set(_vtk_third_party_variables
5325 "${_vtk_third_party_external_USE_VARIABLES}
"
5329 foreach (_vtk_third_party_external_variable IN LISTS _vtk_third_party_external_USE_VARIABLES)
5330 if (NOT DEFINED "${_vtk_third_party_external_variable}
")
5332 "The variable `${_vtk_third_party_external_variable}` was expected
"
5333 "to have been available, but was not defined.
")
5336 set("${_vtk_third_party_external_variable}
"
5337 "${${_vtk_third_party_external_variable}}
"
5342 _vtk_module_mark_third_party("${_vtk_third_party_external_real_target_name}
")
5343 _vtk_module_install("${_vtk_third_party_external_real_target_name}
")
5348@brief Internal third party package
5350Third party modules may also be bundled with the project itself. In this case,
5351it is an internal third party dependency. The dependency is assumed to be in a
5352subdirectory that will be used via `add_subdirectory`. Unless it is marked as
5353`HEADERS_ONLY`, it is assumed that it will create a target with the name of the
5357vtk_module_third_party_internal(
5358 [SUBDIRECTORY <path>]
5359 [HEADERS_SUBDIR <subdir>]
5360 [LICENSE_FILES <file>...]
5364 [STANDARD_INCLUDE_DIRS])
5367All arguments are optional, however warnings are emitted if `LICENSE_FILES` or
5368`VERSION` is not specified. They are as follows:
5370 * `SUBDIRECTORY`: (Defaults to the library name of the module) The
5371 subdirectory containing the `CMakeLists.txt` for the dependency.
5372 * `HEADERS_SUBDIR`: If non-empty, the subdirectory to use for installing
5374 * `LICENSE_FILES`: A list of license files to install for the dependency. If
5375 not given, a warning will be emitted.
5376 * `VERSION`: The version of the library that is included.
5377 * `HEADER_ONLY`: The dependency is header only and will not create a target.
5378 * `INTERFACE`: The dependency is an `INTERFACE` library.
5379 * `STANDARD_INCLUDE_DIRS`: If present, module-standard include directories
5380 will be added to the module target.
5382function (vtk_module_third_party_internal)
5383 # TODO: Support scanning for third-party modules which don't support an
5386 cmake_parse_arguments(PARSE_ARGV 0 _vtk_third_party_internal
5387 "INTERFACE;HEADER_ONLY;STANDARD_INCLUDE_DIRS
"
5388 "SUBDIRECTORY;HEADERS_SUBDIR;VERSION
"
5391 if (_vtk_third_party_internal_UNPARSED_ARGUMENTS)
5394 "${_vtk_third_party_internal_UNPARSED_ARGUMENTS}
")
5397 get_property(_vtk_third_party_internal_is_third_party GLOBAL
5398 PROPERTY "_vtk_module_${_vtk_build_module}_third_party
")
5399 if (NOT _vtk_third_party_internal_is_third_party)
5401 "The ${_vtk_build_module} has not been declared as a third party
"
5405 get_property(_vtk_third_party_internal_library_name GLOBAL
5406 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
")
5407 if (NOT DEFINED _vtk_third_party_internal_SUBDIRECTORY)
5408 set(_vtk_third_party_internal_SUBDIRECTORY "${_vtk_third_party_internal_library_name}
")
5411 if (NOT DEFINED _vtk_third_party_internal_LICENSE_FILES)
5413 "The ${_vtk_build_module} third party
package is embedded, but does not "
5414 "specify any license files.")
5417 if (NOT DEFINED _vtk_third_party_internal_VERSION)
5419 "The ${_vtk_build_module} third party package is embedded, but does not "
5420 "specify the version it is based on.")
5423 get_property(_vtk_third_party_internal_target_name GLOBAL
5424 PROPERTY "_vtk_module_${_vtk_build_module}_target_name")
5425 set(_vtk_third_party_internal_include_type)
5426 if (_vtk_third_party_internal_INTERFACE)
5427 set(_vtk_third_party_internal_include_type INTERFACE)
5428 elseif (_vtk_third_party_internal_HEADER_ONLY)
5429 add_library("${_vtk_third_party_internal_target_name}" INTERFACE)
5430 if (NOT _vtk_build_module STREQUAL _vtk_third_party_internal_target_name)
5431 add_library("${_vtk_build_module}" ALIAS
5432 "${_vtk_third_party_internal_target_name}")
5434 set(_vtk_third_party_internal_include_type INTERFACE)
5435 set(_vtk_third_party_internal_STANDARD_INCLUDE_DIRS 1)
5438 add_subdirectory("${_vtk_third_party_internal_SUBDIRECTORY}")
5440 if (NOT TARGET "${_vtk_build_module}")
5442 "The ${_vtk_build_module} is being built as an internal third party "
5443 "library, but a matching target was not created.")
5446 if (_vtk_third_party_internal_STANDARD_INCLUDE_DIRS)
5447 _vtk_module_standard_includes(
5448 TARGET "${_vtk_third_party_internal_target_name}"
5449 SYSTEM ${_vtk_third_party_internal_include_type}
5450 HEADERS_DESTINATION "${_vtk_build_HEADERS_DESTINATION}/${_vtk_third_party_internal_HEADERS_SUBDIR}")
5453 _vtk_module_apply_properties("${_vtk_third_party_internal_target_name}")
5454 if (_vtk_third_party_internal_INTERFACE)
5456 elseif (_vtk_third_party_internal_HEADER_ONLY)
5457 _vtk_module_install("${_vtk_third_party_internal_target_name}")
5460 if (_vtk_third_party_internal_LICENSE_FILES)
5461 set(_vtk_third_party_internal_license_component "license")
5462 if (_vtk_build_TARGET_SPECIFIC_COMPONENTS)
5463 string(PREPEND _vtk_third_party_internal_license_component "${_vtk_build_module}-")
5466 FILES ${_vtk_third_party_internal_LICENSE_FILES}
5467 DESTINATION "${_vtk_build_LICENSE_DESTINATION}/${_vtk_third_party_internal_library_name}/"
5468 COMPONENT "${_vtk_third_party_internal_license_component}")
5471 _vtk_module_mark_third_party("${_vtk_third_party_internal_target_name}")
Computes the portion of a dataset which is inside a selection.
function _vtk_module_mark_third_party(target)
Mark a module as being third party.
function _vtk_module_standard_includes()
Add "standard" include directories to a module.
function _vtk_module_add_header_tests()
Add header tests for a module.
function _vtk_module_default_export_macro_prefix(varname)
Determine the default export macro for a module.
macro _vtk_module_parse_kit_args(name_output)
Parse vtk.kit file contents.
function _vtk_module_write_wrap_hierarchy()
Generate the hierarchy for a module.
function _vtk_private_kit_link_target(module)
Manage the private link target for a module.
macro _vtk_module_parse_module_args(name_output)
Parse vtk.module file contents.
function _vtk_module_apply_properties(target)
Apply properties to a module.
function _vtk_module_check_destinations(prefix)
Check that destinations are valid.
function _vtk_module_split_module_name(name, prefix)
Split a module name into a namespace and target component.
function _vtk_module_install(target)
Install a module target.
function _vtk_module_set_module_property(module)
Set a module property.
function _vtk_module_debug(domain, format)
Conditionally output debug statements.
function _vtk_module_get_module_property(module)
Get a module property.
macro vtk_module_find_package()
Find a package.
function vtk_module_link(module)
Add link libraries to a module.
function vtk_module_third_party_internal()
Internal third party package.
function vtk_module_definitions(module)
Add compile definitions to a module.
function vtk_module_include(module)
Add include directories to a module.
function vtk_module_scan()
Scan modules and kits.
function vtk_module_sources(module)
Add source files to a module.
function vtk_module_find_modules(output)
Find vtk.module files in a set of directories.
function vtk_module_get_property(module)
Get a property from a module.
function vtk_module_set_property(module)
Set a property on a module.
function vtk_module_third_party_external()
External third party package.
function vtk_module_build()
Build modules and kits.
function vtk_module_export_find_packages()
Export find_package calls for dependencies.
function vtk_module_compile_options(module)
Add compile options to a module.
function vtk_module_autoinit()
Linking to autoinit-using modules.
function vtk_module_find_kits(output)
Find vtk.kit files in a set of directories.
function vtk_module_third_party()
Third party module.
function vtk_module_install_headers()
Install headers.
function vtk_module_add_module(name)
Create a module library.
function vtk_module_compile_features(module)
Add compile features to a module.
function vtk_module_link_options(module)
Add link options to a module.
void put(vtkDataArray *arr, vtkIdType key, const double &value)
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
#define VTK_MODULE_AUTOINIT
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void load(Archiver &ar, std::string &str, const unsigned int vtkNotUsed(version))