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
12 This module includes functions to find and build VTK modules. A module is a
set 13 of related functionality. These are then compiled together into libraries at
14 the
"kit" level. Each module may be
enabled or disabled individually and its
15 dependencies will be built as needed.
17 All functions strictly check their arguments. Any unrecognized or invalid
18 values
for a
function cause errors to be raised.
22 @ingroup module-
internal 23 @page module-
internal-api Internal API
25 The VTK module system provides some API functions
for use by other code which
26 consumes VTK modules (primarily
language wrappers). This file documents these
27 APIs. They may start with `_vtk_module`, but they are intended
for use in cases
28 of
language wrappers or dealing with trickier third party packages.
33 @page module-
impl-api Implementation API
35 These functions are purely
internal implementation details. No guarantees are
36 made
for them and they may change at any
time (including wrapping code calls).
37 Note that these functions are usually very lax in their argument parsing.
41 @ingroup module-
internal 42 @brief Conditionally output debug statements
45 controlled by the `_vtk_module_log` variable which contains a list of
"domains" 52 If the `domain` is
enabled for debugging, the `format` argument is configured
53 and printed. It should contain `@` variable expansions to replace rather than
54 it being done outside. This helps to avoid the cost of generating large strings
55 when 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 78 vtk_module_find_kits(<output> [<directory>...]) 81 This scans the given directories recursively for `vtk.kit` files and put the 82 paths into the output variable. 84 function (vtk_module_find_kits output) 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 100 vtk_module_find_modules(<output> [<directory>...]) 103 This scans the given directories recursively for `vtk.module` files and put the 104 paths into the output variable. Note that module files are assumed to live next 105 to the `CMakeLists.txt` file which will build the module. 107 function (vtk_module_find_modules output) 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) 119 @ingroup module-internal 120 @brief Split a module name into a namespace and target component 122 Module names may include a namespace. This function splits the name into a 123 namespace and target name part. 126 _vtk_module_split_module_name(<name> <prefix>) 129 The `<prefix>_NAMESPACE` and `<prefix>_TARGET_NAME` variables will be set in 132 function (_vtk_module_split_module_name name prefix) 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 157 The `vtk.module` file is parsed and used as arguments to a CMake function which 158 stores information about the module for use when building it. Note that no 159 variable expansion is allowed and it is not CMake code, so no control flow is 160 allowed. Comments are supported and any content after a `#` on a line is 161 treated as a comment. Due to the breakdown of the content, quotes are not 162 meaningful within the files. 172 The base VTK library. 182 All values are optional unless otherwise noted. The following arguments are 185 * `NAME`: (Required) The name of the module. 186 * `LIBRARY_NAME`: The base name of the library file. It defaults to the 187 module name, but any namespaces are removed. For example, a `NS::Foo` 188 module will have a default `LIBRARY_NAME` of `Foo`. 189 * `DESCRIPTION`: (Recommended) Short text describing what the module is for. 190 * `KIT`: The name of the kit the module belongs to (see `Kits files` for more 192 * `IMPLEMENTABLE`: If present, the module contains logic which supports the 193 autoinit functionality. 194 * `GROUPS`: Modules may belong to "groups
" which is exposed as a build 195 option. This allows for enabling a set of modules with a single build 197 * `CONDITION`: Arguments to CMake's `if` command which may be used to hide 198 the module for certain platforms or other reasons. If the expression is 199 false, the module is completely ignored. 200 * `DEPENDS`: A list of modules which are required by this module and modules 202 * `PRIVATE_DEPENDS`: A list of modules which are required by this module, but 203 not by those using this module. 204 * `OPTIONAL_DEPENDS`: A list of modules which are used by this module if 205 enabled; these are treated as `PRIVATE_DEPENDS` if they exist. 206 * `ORDER_DEPENDS`: Dependencies which only matter for ordering. This does not 207 mean that the module will be enabled, just guaranteed to build before this 209 * `IMPLEMENTS`: A list of modules for which this module needs to register 211 * `TEST_DEPENDS`: Modules required by the test suite for this module. 212 * `TEST_OPTIONAL_DEPENDS`: Modules used by the test suite for this module if 214 * `TEST_LABELS`: Labels to apply to the tests of this module. By default, the 215 module name is applied as a label. 216 * `EXCLUDE_WRAP`: If present, this module should not be wrapped in any 218 * `THIRD_PARTY`: If present, this module is a third party module. 223 @brief Parse `vtk.module` file contents 225 This macro places all `vtk.module` keyword "arguments
" into the caller's scope 226 prefixed with the value of `name_output` which is set to the `NAME` of the 230 _vtk_module_parse_module_args(name_output <vtk.module args...>) 233 For example, this `vtk.module` file: 242 called with `_vtk_module_parse_module_args(name ...)` will set the following 243 variables in the calling scope: 245 - `name`: `Namespace::Target` 246 - `Namespace::Target_LIBRARY_NAME`: `nsTarget` 248 With namespace support for module names, the variable should instead be 249 referenced via `${${name}_LIBRARY_NAME}` instead. 251 macro (_vtk_module_parse_module_args name_output) 252 cmake_parse_arguments("_name
" 260 "A VTK module requires a
name (from ${_vtk_scan_module_file}).
") 262 set("${name_output}
" "${_name_NAME}
") 264 cmake_parse_arguments("${_name_NAME}
" 265 "IMPLEMENTABLE;EXCLUDE_WRAP;THIRD_PARTY
" 266 "LIBRARY_NAME;NAME;KIT
" 267 "GROUPS;DEPENDS;PRIVATE_DEPENDS;OPTIONAL_DEPENDS;ORDER_DEPENDS;TEST_DEPENDS;TEST_OPTIONAL_DEPENDS;TEST_LABELS;DESCRIPTION;CONDITION;IMPLEMENTS
" 270 if (${_name_NAME}_UNPARSED_ARGUMENTS) 272 "Unparsed arguments
for ${_name_NAME}:
" 273 "${${_name_NAME}_UNPARSED_ARGUMENTS}
") 276 if (NOT ${_name_NAME}_DESCRIPTION AND _vtk_module_warnings) 277 message(WARNING "The ${_name_NAME} module should have a
description") 279 string(REPLACE ";
" " " "${_name_NAME}_DESCRIPTION
" "${${_name_NAME}_DESCRIPTION}
") 281 _vtk_module_split_module_name("${_name_NAME}
" "${_name_NAME}
") 283 if (NOT DEFINED "${_name_NAME}_LIBRARY_NAME
") 284 set("${_name_NAME}_LIBRARY_NAME
" "${${_name_NAME}_TARGET_NAME}
") 287 if (NOT ${_name_NAME}_LIBRARY_NAME) 288 message(FATAL_ERROR "The ${_name_NAME} module must have a non-empty `LIBRARY_NAME`.
") 291 list(APPEND "${_name_NAME}_TEST_LABELS
" 292 "${${_name_NAME}_NAME}
" 293 "${${_name_NAME}_LIBRARY_NAME}
") 297 @page module-overview 299 @section module-parse-kit vtk.kit file contents 301 The `vtk.kit` file is parsed similarly to `vtk.module` files. Kits are intended 302 to bring together related modules into a single library in order to reduce the 303 number of objects that linkers need to deal with. 313 Core utilities for VTK. 316 All values are optional unless otherwise noted. The following arguments are 319 * `NAME`: (Required) The name of the kit. 320 * `LIBRARY_NAME`: The base name of the library file. It defaults to the 321 module name, but any namespaces are removed. For example, a `NS::Foo` 322 module will have a default `LIBRARY_NAME` of `Foo`. 323 * `DESCRIPTION`: (Recommended) Short text describing what the kit contains. 328 @brief Parse `vtk.kit` file contents 330 Just like @ref _vtk_module_parse_module_args, but for kits. 332 macro (_vtk_module_parse_kit_args name_output) 333 cmake_parse_arguments("_name
" 341 "A VTK kit requires a
name (from ${_vtk_scan_kit_file}).
") 343 set("${name_output}
" "${_name_NAME}
") 345 cmake_parse_arguments("${_name_NAME}
" 351 if (${_name_NAME}_UNPARSED_ARGUMENTS) 353 "Unparsed arguments
for ${_name_NAME}:
" 354 "${${_name_NAME}_UNPARSED_ARGUMENTS}
") 357 _vtk_module_split_module_name("${_name_NAME}
" "${_name_NAME}
") 359 if (NOT DEFINED "${_name_NAME}_LIBRARY_NAME
") 360 set("${_name_NAME}_LIBRARY_NAME
" "${${_name_NAME}_TARGET_NAME}
") 363 if (NOT ${_name_NAME}_LIBRARY_NAME) 364 message(FATAL_ERROR "The ${_name_NAME} module must have a non-empty `LIBRARY_NAME`.
") 367 if (NOT ${_name_NAME}_DESCRIPTION AND _vtk_module_warnings) 368 message(WARNING "The ${_name_NAME} kit should have a
description") 370 string(REPLACE ";
" " " "${_name_NAME}_DESCRIPTION
" "${${_name_NAME}_DESCRIPTION}
") 374 @page module-overview 377 @section module-enable-status Enable status values 379 Modules and groups are enable and disable preferences are specified using a 382 - `YES`: The module or group must be built. 383 - `NO`: The module or group must not be built. 384 - `WANT`: The module or group should be built if possible. 385 - `DONT_WANT`: The module or group should only be built if required (e.g., 387 - `DEFAULT`: Acts as either `WANT` or `DONT_WANT` based on the group settings 388 for the module or `WANT_BY_DEFAULT` option to @ref vtk_module_scan if no 389 other preference is specified. This is usually handled via another setting 392 If a `YES` module preference requires a module with a `NO` preference, an error 395 A module with a setting of `DEFAULT` will look for its first non-`DEFAULT` 396 group setting and only if all of those are set to `DEFAULT` is the 397 `WANT_BY_DEFAULT` setting used. 402 @brief Verify enable values 404 Verifies that the variable named as the first parameter is a valid `enable 408 _vtk_module_verify_enable_value(var) 411 function (_vtk_module_verify_enable_value var) 412 if (NOT (${var} STREQUAL "YES
" OR 413 ${var} STREQUAL "WANT
" OR 414 ${var} STREQUAL "DONT_WANT
" OR 415 ${var} STREQUAL "NO
" OR 416 ${var} STREQUAL "DEFAULT
")) 418 "The `${var}` variable must be one of `YES`, `WANT`, `DONT_WANT`, `NO`,
" 419 "or `DEFAULT`. Found `${${var}}`.
") 423 include("${CMAKE_CURRENT_LIST_DIR}/vtkTopologicalSort.cmake
") 427 @brief Scan modules and kits 429 Once all of the modules and kits files have been found, they are "scanned
" to 430 determine what modules are enabled or required. 434 MODULE_FILES <file>... 435 [KIT_FILES <file>...] 436 PROVIDES_MODULES <variable> 437 [PROVIDES_KITS <variable>] 438 [REQUIRES_MODULES <variable>] 439 [REQUEST_MODULES <module>...] 440 [REJECT_MODULES <module>...] 441 [UNRECOGNIZED_MODULES <variable>] 442 [WANT_BY_DEFAULT <ON|OFF>] 443 [HIDE_MODULES_FROM_CACHE <ON|OFF>] 444 [ENABLE_TESTS <ON|OFF|WANT|DEFAULT>]) 447 The `MODULE_FILES` and `PROVIDES_MODULES` arguments are required. Modules which 448 refer to kits must be scanned at the same time as their kits. This is so that 449 modules may not add themselves to kits declared prior. The arguments are as follows: 451 * `MODULE_FILES`: (Required) The list of module files to scan. 452 * `KIT_FILES`: The list of kit files to scan. 453 * `PROVIDES_MODULES`: (Required) This variable will contain the list of 454 modules which are enabled due to this scan. 455 * `PROVIDES_KITS`: (Required if `KIT_FILES` are provided) This variable will 456 contain the list of kits which are enabled due to this scan. 457 * `REQUIRES_MODULES`: This variable will contain the list of modules required 458 by the enabled modules that were not scanned. 459 * `REQUEST_MODULES`: The list of modules required by previous scans. 460 * `REJECT_MODULES`: The list of modules to exclude from the scan. If any of 461 these modules are required, an error will be raised. 462 * `UNRECOGNIZED_MODULES`: This variable will contain the list of requested 463 modules that were not scanned. 464 * `WANT_BY_DEFAULT`: (Defaults to `OFF`) Whether modules should default to 466 * `HIDE_MODULES_FROM_CACHE`: (Defaults to `OFF`) Whether or not to hide the 467 control variables from the cache or not. If enabled, modules will not be 468 built unless they are required elsewhere. 469 * `ENABLE_TESTS`: (Defaults to `WANT`) Whether or not modules required by 470 the tests for the scanned modules should be enabled or not. 471 - `ON`: Modules listed as `TEST_DEPENDS` will be required. 472 - `OFF`: Test modules will not be considered. 473 - `WANT`: Test dependencies will enable modules if possible. 474 - `DEFAULT`: Test modules will be enabled if their required dependencies 475 are satisfied and skipped otherwise. 477 @section module-scanning-multiple Scanning multiple groups of modules 479 When scanning complicated projects, multiple scans may be required to get 480 defaults set properly. The `REQUIRES_MODULES`, `REQUEST_MODULES`, and 481 `UNRECOGNIZED_MODULES` arguments are meant to deal with this case. As an 482 example, imagine a project with its source code, third party dependencies, as 483 well as some utility modules which should only be built as necessary. Here, the 484 project would perform three scans, one for each "grouping
" of modules: 487 # Scan our modules first because we need to know what of the other groups we 489 vtk_module_find_modules(our_modules "${CMAKE_CURRENT_SOURCE_DIR}/src
") 491 MODULE_FILES ${our_modules} 492 PROVIDES_MODULES our_enabled_modules 493 REQUIRES_MODULES required_modules) 495 # Scan the third party modules, requesting only those that are necessary, but 496 # allowing them to be toggled during the build. 497 vtk_module_find_modules(third_party_modules "${CMAKE_CURRENT_SOURCE_DIR}/third-party
") 499 MODULE_FILES ${third_party_modules} 500 PROVIDES_MODULES third_party_enabled_modules 501 # These modules were requested by an earlier scan. 502 REQUEST_MODULES ${required_modules} 503 REQUIRES_MODULES required_modules 504 UNRECOGNIZED_MODULES unrecognized_modules) 506 # These modules are internal and should only be built if necessary. There is no 507 # need to support them being enabled independently, so hide them from the 509 vtk_module_find_modules(utility_modules "${CMAKE_CURRENT_SOURCE_DIR}/utilities
") 511 MODULE_FILES ${utility_modules} 512 PROVIDES_MODULES utility_enabled_modules 513 # These modules were either requested or unrecognized by an earlier scan. 514 REQUEST_MODULES ${required_modules} 515 ${unrecognized_modules} 516 REQUIRES_MODULES required_modules 517 UNRECOGNIZED_MODULES unrecognized_modules 518 HIDE_MODULES_FROM_CACHE ON) 520 if (required_modules OR unrecognized_modules) 521 # Not all of the modules we required were found. This should probably error out. 525 function (vtk_module_scan) 526 cmake_parse_arguments(_vtk_scan 528 "WANT_BY_DEFAULT;HIDE_MODULES_FROM_CACHE;PROVIDES_MODULES;REQUIRES_MODULES;UNRECOGNIZED_MODULES;ENABLE_TESTS;PROVIDES_KITS
" 529 "MODULE_FILES;KIT_FILES;REQUEST_MODULES;REJECT_MODULES
" 532 if (_vtk_scan_UNPARSED_ARGUMENTS) 535 "${_vtk_scan_UNPARSED_ARGUMENTS}
") 538 if (NOT DEFINED _vtk_scan_WANT_BY_DEFAULT) 539 set(_vtk_scan_WANT_BY_DEFAULT OFF) 542 if (NOT DEFINED _vtk_scan_HIDE_MODULES_FROM_CACHE) 543 set(_vtk_scan_HIDE_MODULES_FROM_CACHE OFF) 546 if (NOT DEFINED _vtk_scan_PROVIDES_MODULES) 548 "The `PROVIDES_MODULES` argument is required.
") 551 if (NOT DEFINED _vtk_scan_PROVIDES_KITS AND _vtk_scan_KIT_FILES) 553 "The `PROVIDES_KITS` argument is required.
") 556 if (NOT DEFINED _vtk_scan_ENABLE_TESTS) 557 set(_vtk_scan_ENABLE_TESTS "WANT
") 560 if (NOT (_vtk_scan_ENABLE_TESTS STREQUAL "ON
" OR 561 _vtk_scan_ENABLE_TESTS STREQUAL "OFF
" OR 562 _vtk_scan_ENABLE_TESTS STREQUAL "WANT
" OR 563 _vtk_scan_ENABLE_TESTS STREQUAL "DEFAULT
")) 565 "The `ENABLE_TESTS` argument must be one of `ON`, `OFF`, `WANT`, or
" 566 "`DEFAULT`.
" "Received `${_vtk_scan_ENABLE_TESTS}`.
") 569 if (NOT _vtk_scan_MODULE_FILES) 571 "No module files given to scan.
") 574 set(_vtk_scan_option_default_type STRING) 575 if (_vtk_scan_HIDE_MODULES_FROM_CACHE) 576 set(_vtk_scan_option_default_type INTERNAL) 579 set(_vtk_scan_all_kits) 581 foreach (_vtk_scan_kit_file IN LISTS _vtk_scan_KIT_FILES) 582 if (NOT IS_ABSOLUTE "${_vtk_scan_kit_file}
") 583 set(_vtk_scan_kit_file "${CMAKE_CURRENT_SOURCE_DIR}/${_vtk_scan_kit_file}
") 585 set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}
" APPEND 587 CMAKE_CONFIGURE_DEPENDS "${_vtk_scan_kit_file}
") 589 file(READ "${_vtk_scan_kit_file}
" _vtk_scan_kit_args) 591 string(REGEX REPLACE "#[^\n]*\n
" "\n
" _vtk_scan_kit_args "${_vtk_scan_kit_args}
") 592 # Use argument splitting. 593 string(REGEX REPLACE "( |\n)+
" ";
" _vtk_scan_kit_args "${_vtk_scan_kit_args}
") 594 _vtk_module_parse_kit_args(_vtk_scan_kit_name ${_vtk_scan_kit_args}) 595 _vtk_module_debug(kit "@_vtk_scan_kit_name@ declared by @_vtk_scan_kit_file
@") 597 list(APPEND _vtk_scan_all_kits 598 "${_vtk_scan_kit_name}
") 600 # Set properties for building. 603 "_vtk_kit_${_vtk_scan_kit_name}_namespace
" "${${_vtk_scan_kit_name}_NAMESPACE}
") 606 "_vtk_kit_${_vtk_scan_kit_name}_target_name
" "${${_vtk_scan_kit_name}_TARGET_NAME}
") 609 "_vtk_kit_${_vtk_scan_kit_name}_library_name
" "${${_vtk_scan_kit_name}_LIBRARY_NAME}
") 612 set(_vtk_scan_all_modules) 613 set(_vtk_scan_all_groups) 614 set(_vtk_scan_rejected_modules) 616 # Read all of the module files passed in. 617 foreach (_vtk_scan_module_file IN LISTS _vtk_scan_MODULE_FILES) 618 if (NOT IS_ABSOLUTE "${_vtk_scan_module_file}
") 619 set(_vtk_scan_module_file "${CMAKE_CURRENT_SOURCE_DIR}/${_vtk_scan_module_file}
") 621 set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}
" APPEND 623 CMAKE_CONFIGURE_DEPENDS "${_vtk_scan_module_file}
") 625 file(READ "${_vtk_scan_module_file}
" _vtk_scan_module_args) 627 string(REGEX REPLACE "#[^\n]*\n
" "\n
" _vtk_scan_module_args "${_vtk_scan_module_args}
") 628 # Use argument splitting. 629 string(REGEX REPLACE "( |\n)+
" ";
" _vtk_scan_module_args "${_vtk_scan_module_args}
") 630 _vtk_module_parse_module_args(_vtk_scan_module_name ${_vtk_scan_module_args}) 631 _vtk_module_debug(module "@_vtk_scan_module_name@ declared by @_vtk_scan_module_file
@") 632 string(REPLACE "::
" "_
" _vtk_scan_module_name_safe "${_vtk_scan_module_name}
") 634 if (${_vtk_scan_module_name}_THIRD_PARTY) 635 if (_vtk_module_warnings) 636 if (${_vtk_scan_module_name}_EXCLUDE_WRAP) 638 "The third party ${_vtk_scan_module_name} module does not need to
" 639 "declare `EXCLUDE_WRAP` also.
") 642 if (${_vtk_scan_module_name}_IMPLEMENTABLE) 644 "The third party ${_vtk_scan_module_name} module may not be
" 647 if (${_vtk_scan_module_name}_IMPLEMENTS) 649 "The third party ${_vtk_scan_module_name} module may not
" 650 "`IMPLEMENTS` another module.
") 652 if (${_vtk_scan_module_name}_KIT) 654 "The third party ${_vtk_scan_module_name} module may not be part of
" 655 "a kit (${${_vtk_scan_module_name}_KIT}).
") 659 if (${_vtk_scan_module_name}_KIT) 660 if (NOT ${_vtk_scan_module_name}_KIT IN_LIST _vtk_scan_all_kits) 662 "The ${_vtk_scan_module_name} belongs to the
" 663 "${${_vtk_scan_module_name}_KIT} kit, but it has not been scanned.
") 667 # Check if the module is visible. Modules which have a failing condition 668 # are basically invisible. 669 if (DEFINED ${_vtk_scan_module_name}_CONDITION) 670 if (NOT (${${_vtk_scan_module_name}_CONDITION})) 671 if (DEFINED "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
") 672 set_property(CACHE "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
" 676 _vtk_module_debug(module "@_vtk_scan_module_name@ hidden by its `CONDITION`
") 681 # Determine whether we should provide a user-visible option for this 683 set(_vtk_build_use_option 1) 684 if (DEFINED _vtk_scan_REQUEST_MODULE) 685 if (_vtk_scan_module_name IN_LIST _vtk_scan_REQUEST_MODULE) 686 set("_vtk_scan_enable_${_vtk_scan_module_name}
" YES) 687 set(_vtk_build_use_option 0) 690 if (DEFINED _vtk_scan_REJECT_MODULES) 691 if (_vtk_scan_module_name IN_LIST _vtk_scan_REJECT_MODULES) 692 if (NOT _vtk_build_use_option) 694 "The ${_vtk_scan_module_name} module has been requested and rejected.
") 696 # Rejected modules should not have a build option. 697 set(_vtk_build_use_option 0) 698 list(APPEND _vtk_scan_rejected_modules 699 "${_vtk_scan_module_name}
") 703 # Handle cache entries and determine the enabled state of the module from 704 # the relevant cache variables. 705 if (_vtk_build_use_option) 706 set("VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
" "DEFAULT
" 707 CACHE STRING "Enable the ${_vtk_scan_module_name} module. ${${_vtk_scan_module_name}_DESCRIPTION}
") 708 mark_as_advanced("VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
") 709 set_property(CACHE "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
" 711 STRINGS "YES;WANT;DONT_WANT;NO;DEFAULT
") 712 _vtk_module_verify_enable_value("VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
") 714 if (NOT VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe} STREQUAL "DEFAULT
") 715 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "${VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}}
") 716 _vtk_module_debug(enable "@_vtk_scan_module_name@ is `${_vtk_scan_enable_${_vtk_scan_module_name}}` by cache
value") 719 # Check the state of any groups the module belongs to. 720 foreach (_vtk_scan_group IN LISTS "${_vtk_scan_module_name}_GROUPS
") 721 if (NOT DEFINED "VTK_GROUP_ENABLE_${_vtk_scan_group}
") 722 set(_vtk_scan_group_default "DEFAULT
") 723 if (DEFINED "_vtk_module_group_default_${_vtk_scan_group}
") 724 set(_vtk_scan_group_default "${_vtk_module_group_default_${_vtk_scan_group}}
") 726 set("VTK_GROUP_ENABLE_${_vtk_scan_group}
" "${_vtk_scan_group_default}
" 727 CACHE STRING "Enable the ${_vtk_scan_group} group modules.
") 728 set_property(CACHE "VTK_GROUP_ENABLE_${_vtk_scan_group}
" 730 STRINGS "YES;WANT;DONT_WANT;NO;DEFAULT
") 731 set_property(CACHE "VTK_GROUP_ENABLE_${_vtk_scan_group}
" 733 TYPE "${_vtk_scan_option_default_type}
") 735 _vtk_module_verify_enable_value("VTK_GROUP_ENABLE_${_vtk_scan_group}
") 737 if (NOT VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe} STREQUAL "DEFAULT
") 741 # Determine the state of the group. 742 set(_vtk_scan_group_enable "${VTK_GROUP_ENABLE_${_vtk_scan_group}}
") 743 if (NOT _vtk_scan_group_enable STREQUAL "DEFAULT
") 744 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "${_vtk_scan_group_enable}
") 745 _vtk_module_debug(enable "@_vtk_scan_module_name@ is DEFAULT,
using group `@_vtk_scan_group@` setting: @_vtk_scan_group_enable
@") 749 set_property(CACHE "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
" 751 TYPE "${_vtk_scan_option_default_type}
") 754 if (NOT DEFINED "_vtk_scan_enable_${_vtk_scan_module_name}
" AND 755 VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe} STREQUAL "DEFAULT
") 756 if (_vtk_scan_WANT_BY_DEFAULT) 757 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "WANT
") 759 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "DONT_WANT
") 761 _vtk_module_debug(enable "@_vtk_scan_module_name@ is DEFAULT,
using `WANT_BY_DEFAULT`: ${_vtk_scan_enable_${_vtk_scan_module_name}}
") 764 list(APPEND _vtk_scan_all_modules 765 "${_vtk_scan_module_name}
") 766 set("_vtk_scan_${_vtk_scan_module_name}_all_depends
" 767 ${${_vtk_scan_module_name}_DEPENDS} 768 ${${_vtk_scan_module_name}_PRIVATE_DEPENDS}) 770 if (${_vtk_scan_module_name}_THIRD_PARTY) 771 set("${_vtk_scan_module_name}_EXCLUDE_WRAP
" TRUE) 772 set("${_vtk_scan_module_name}_IMPLEMENTABLE
" FALSE) 773 set("${_vtk_scan_module_name}_IMPLEMENTS
") 776 if (${_vtk_scan_module_name}_KIT) 777 _vtk_module_debug(kit "@_vtk_scan_module_name@ belongs to the ${${_vtk_scan_module_name}_KIT} kit
") 780 # Set properties for building. 783 "_vtk_module_${_vtk_scan_module_name}_file
" "${_vtk_scan_module_file}
") 786 "_vtk_module_${_vtk_scan_module_name}_namespace
" "${${_vtk_scan_module_name}_NAMESPACE}
") 789 "_vtk_module_${_vtk_scan_module_name}_target_name
" "${${_vtk_scan_module_name}_TARGET_NAME}
") 792 "_vtk_module_${_vtk_scan_module_name}_library_name
" "${${_vtk_scan_module_name}_LIBRARY_NAME}
") 795 "_vtk_module_${_vtk_scan_module_name}_third_party
" "${${_vtk_scan_module_name}_THIRD_PARTY}
") 798 "_vtk_module_${_vtk_scan_module_name}_exclude_wrap
" "${${_vtk_scan_module_name}_EXCLUDE_WRAP}
") 801 "_vtk_module_${_vtk_scan_module_name}_kit
" "${${_vtk_scan_module_name}_KIT}
") 804 "_vtk_module_${_vtk_scan_module_name}_depends
" "${${_vtk_scan_module_name}_DEPENDS}
") 807 "_vtk_module_${_vtk_scan_module_name}_order_depends
" "${${_vtk_scan_module_name}_ORDER_DEPENDS}
") 810 "_vtk_module_${_vtk_scan_module_name}_private_depends
" "${${_vtk_scan_module_name}_PRIVATE_DEPENDS}
") 813 "_vtk_module_${_vtk_scan_module_name}_optional_depends
" "${${_vtk_scan_module_name}_OPTIONAL_DEPENDS}
") 816 "_vtk_module_${_vtk_scan_module_name}_test_depends
" "${${_vtk_scan_module_name}_TEST_DEPENDS}
") 819 "_vtk_module_${_vtk_scan_module_name}_test_optional_depends
" "${${_vtk_scan_module_name}_TEST_OPTIONAL_DEPENDS}
") 822 "_vtk_module_${_vtk_scan_module_name}_test_labels
" "${${_vtk_scan_module_name}_TEST_LABELS}
") 825 "_vtk_module_${_vtk_scan_module_name}_implements
" "${${_vtk_scan_module_name}_IMPLEMENTS}
") 828 "_vtk_module_${_vtk_scan_module_name}_implementable
" "${${_vtk_scan_module_name}_IMPLEMENTABLE}
") 831 set(_vtk_scan_current_modules "${_vtk_scan_all_modules}
") 832 vtk_topological_sort(_vtk_scan_all_modules "_vtk_scan_
" "_all_depends
") 834 set(_vtk_scan_provided_modules) 835 set(_vtk_scan_required_modules) 836 set(_vtk_scan_disabled_modules) 838 # Seed the `_vtk_scan_provide_` variables with modules requested and rejected 840 foreach (_vtk_scan_request_module IN LISTS _vtk_scan_REQUEST_MODULES) 841 set("_vtk_scan_provide_${_vtk_scan_request_module}
" ON) 842 _vtk_module_debug(provide "@_vtk_scan_request_module@ is provided via `REQUEST_MODULES`
") 844 foreach (_vtk_scan_reject_module IN LISTS _vtk_scan_REJECT_MODULES) 845 set("_vtk_scan_provide_${_vtk_scan_reject_module}
" OFF) 846 _vtk_module_debug(provide "@_vtk_scan_reject_module@ is not provided via `REJECT_MODULES`
") 849 # Traverse the graph classifying the quad-state for enabling modules into a 850 # boolean stored in the `_vtk_scan_provide_` variables. 851 foreach (_vtk_scan_module IN LISTS _vtk_scan_all_modules) 852 if (NOT _vtk_scan_module IN_LIST _vtk_scan_current_modules) 853 _vtk_module_debug(provide "@_vtk_scan_module@ is ignored because it is not in the current scan
set") 857 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module}
") 859 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "YES
") 860 # Mark enabled modules as to-be-provided. Any errors with requiring a 861 # disabled module will be dealt with later. 862 set("_vtk_scan_provide_${_vtk_scan_module}
" ON) 863 _vtk_module_debug(provide "@_vtk_scan_module@ is provided due to `YES` setting
") 864 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "WANT
") 865 # Check to see if we can provide this module by checking of any of its 866 # dependencies have been disabled. 867 set(_vtk_scan_test_depends) 868 if (NOT ${_vtk_scan_module}_THIRD_PARTY AND _vtk_scan_ENABLE_TESTS STREQUAL "ON
") 869 # If the tests have to be on, we also need the test dependencies. 870 set(_vtk_scan_test_depends "${${_vtk_scan_module}_TEST_DEPENDS}
") 873 set("_vtk_scan_provide_${_vtk_scan_module}
" ON) 874 _vtk_module_debug(provide "@_vtk_scan_module@ is provided due to `WANT` setting
") 875 foreach (_vtk_scan_module_depend IN LISTS "${_vtk_scan_module}_DEPENDS
" "${_vtk_scan_module}_PRIVATE_DEPENDS
" _vtk_scan_test_depends) 876 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module_depend}
" AND NOT _vtk_scan_provide_${_vtk_scan_module_depend}) 877 set("_vtk_scan_provide_${_vtk_scan_module}
" OFF) 878 _vtk_module_debug(provide "@_vtk_scan_module@ is not provided due to not provided dependency @_vtk_scan_module_depend
@") 882 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "DONT_WANT
") 883 # Check for disabled dependencies and disable if so. 884 foreach (_vtk_scan_module_depend IN LISTS "${_vtk_scan_module}_DEPENDS
" "${_vtk_scan_module}_PRIVATE_DEPENDS
" _vtk_scan_test_depends) 885 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module_depend}
" AND NOT _vtk_scan_provide_${_vtk_scan_module_depend}) 886 set("_vtk_scan_provide_${_vtk_scan_module}
" OFF) 887 _vtk_module_debug(provide "@_vtk_scan_module@ is not provided due to not provided dependency @_vtk_scan_module_depend
@") 891 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "NO
") 892 # Disable the module. 893 set("_vtk_scan_provide_${_vtk_scan_module}
" OFF) 894 _vtk_module_debug(provide "@_vtk_scan_module@ is not provided due to `NO` setting
") 897 # Collect disabled modules into a list. 898 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module}
" AND NOT _vtk_scan_provide_${_vtk_scan_module}) 899 list(APPEND _vtk_scan_disabled_modules 900 "${_vtk_scan_module}
") 903 if (NOT DEFINED "_vtk_scan_provide_${_vtk_scan_module}
") 904 _vtk_module_debug(provide "@_vtk_scan_module@ is indeterminite (${_vtk_scan_enable_${_vtk_scan_module}})
") 908 # Scan all modules from the top of tree to the bottom. 909 list(REVERSE _vtk_scan_all_modules) 910 foreach (_vtk_scan_module IN LISTS _vtk_scan_all_modules) 911 if (NOT _vtk_scan_module IN_LIST _vtk_scan_current_modules) 915 # If we're providing this module... 916 if (_vtk_scan_provide_${_vtk_scan_module}) 917 list(APPEND _vtk_scan_provided_modules 918 "${_vtk_scan_module}
") 920 # Grab any test dependencies that are required. 921 set(_vtk_scan_test_depends) 922 set(_vtk_scan_test_wants) 923 if (NOT ${_vtk_scan_module}_THIRD_PARTY) 924 if (_vtk_scan_ENABLE_TESTS STREQUAL "ON
") 925 set_property(GLOBAL APPEND 927 "_vtk_module_test_modules
" "${_vtk_scan_module}
") 928 set(_vtk_scan_test_depends "${${_vtk_scan_module}_TEST_DEPENDS}
") 929 elseif (_vtk_scan_ENABLE_TESTS STREQUAL "WANT
") 930 set_property(GLOBAL APPEND 932 "_vtk_module_test_modules
" "${_vtk_scan_module}
") 933 set(_vtk_scan_test_wants _vtk_scan_wants_marker ${${_vtk_scan_module}_TEST_DEPENDS}) 934 elseif (_vtk_scan_ENABLE_TESTS STREQUAL "DEFAULT
") 935 set_property(GLOBAL APPEND 937 "_vtk_module_test_modules
" "${_vtk_scan_module}
") 938 elseif (_vtk_scan_ENABLE_TESTS STREQUAL "OFF
") 942 "Unrecognized option
for ENABLE_TESTS: ${_vtk_module_ENABLE_TESTS}.
") 946 # Add all dependent modules to the list of required or provided modules. 947 set(_vtk_scan_is_wanting 0) 948 foreach (_vtk_scan_module_depend IN LISTS "${_vtk_scan_module}_DEPENDS
" "${_vtk_scan_module}_PRIVATE_DEPENDS
" _vtk_scan_test_depends _vtk_scan_test_wants) 949 if (_vtk_scan_module_depend STREQUAL "_vtk_scan_wants_marker
") 950 set(_vtk_scan_is_wanting 1) 953 # Though we need to error if this would cause a disabled module to be 955 if (_vtk_scan_module_depend IN_LIST _vtk_scan_disabled_modules) 956 if (_vtk_scan_is_wanting) 960 "The ${_vtk_scan_module} module requires the disabled module ${_vtk_scan_module_depend}.
") 964 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module_depend}
") 965 if (NOT _vtk_scan_provide_${_vtk_scan_module_depend}) 967 "The `${_vtk_scan_module_depend} should be provided, but is disabled.
") 971 set("_vtk_scan_provide_${_vtk_scan_module_depend}
" ON) 973 if (NOT _vtk_scan_module_depend IN_LIST _vtk_scan_current_modules) 974 if (NOT TARGET "${_vtk_scan_module_depend}
") 975 _vtk_module_debug(provide "@_vtk_scan_module_depend@ is external and required due to dependency from @_vtk_scan_module
@") 977 list(APPEND _vtk_scan_required_modules 978 "${_vtk_scan_module_depend}
") 980 _vtk_module_debug(provide "@_vtk_scan_module_depend@ is provided due to dependency from @_vtk_scan_module
@") 981 list(APPEND _vtk_scan_provided_modules 982 "${_vtk_scan_module_depend}
") 988 if (_vtk_scan_provided_modules) 989 list(REMOVE_DUPLICATES _vtk_scan_provided_modules) 992 set(_vtk_scan_provided_kits) 994 # Build a list of kits which contain the provided modules. 995 foreach (_vtk_scan_provided_module IN LISTS _vtk_scan_provided_modules) 996 if (${_vtk_scan_provided_module}_KIT) 997 list(APPEND _vtk_scan_provided_kits 998 "${${_vtk_scan_provided_module}_KIT}
") 999 set_property(GLOBAL APPEND 1001 "_vtk_kit_${${_vtk_scan_provided_module}_KIT}_kit_modules
" "${_vtk_scan_provided_module}
") 1005 if (_vtk_scan_provided_kits) 1006 list(REMOVE_DUPLICATES _vtk_scan_provided_kits) 1009 if (_vtk_scan_required_modules) 1010 list(REMOVE_DUPLICATES _vtk_scan_required_modules) 1013 set(_vtk_scan_unrecognized_modules 1014 ${_vtk_scan_REQUEST_MODULES} 1015 ${_vtk_scan_REJECT_MODULES}) 1017 if (_vtk_scan_unrecognized_modules AND (_vtk_scan_provided_modules OR _vtk_scan_rejected_modules)) 1018 list(REMOVE_ITEM _vtk_scan_unrecognized_modules 1019 ${_vtk_scan_provided_modules} 1020 ${_vtk_scan_rejected_modules}) 1023 set("${_vtk_scan_PROVIDES_MODULES}
" 1024 ${_vtk_scan_provided_modules} 1027 if (DEFINED _vtk_scan_REQUIRES_MODULES) 1028 set("${_vtk_scan_REQUIRES_MODULES}
" 1029 ${_vtk_scan_required_modules} 1033 if (DEFINED _vtk_scan_UNRECOGNIZED_MODULES) 1034 set("${_vtk_scan_UNRECOGNIZED_MODULES}
" 1035 ${_vtk_scan_unrecognized_modules} 1039 if (DEFINED _vtk_scan_PROVIDES_KITS) 1040 set("${_vtk_scan_PROVIDES_KITS}
" 1041 ${_vtk_scan_provided_kits} 1047 @page module-overview 1049 @section module-target-functions Module-as-target functions 1051 Due to the nature of VTK modules supporting being built as kits, the module 1052 name might not be usable as a target to CMake's `target_` family of commands. 1053 Instead, there are various wrappers around them which take the module name as 1054 an argument. These handle the forwarding of relevant information to the kit 1055 library as well where necessary. 1057 - @ref vtk_module_set_properties 1058 - @ref vtk_module_set_property 1059 - @ref vtk_module_get_property 1060 - @ref vtk_module_depend 1061 - @ref vtk_module_include 1062 - @ref vtk_module_definitions 1063 - @ref vtk_module_compile_options 1064 - @ref vtk_module_compile_features 1065 - @ref vtk_module_link 1066 - @ref vtk_module_link_options 1070 @page module-internal-api 1072 @section module-target-internals Module target internals 1074 When manipulating modules as targets, there are a few functions provided for 1075 use in wrapping code to more easily access them. 1077 - @ref _vtk_module_real_target 1078 - @ref _vtk_module_real_target_kit 1082 @ingroup module-internal 1083 @brief The real target for a module 1086 _vtk_module_real_target(<var> <module>) 1089 Sometimes the actual, core target for a module is required (e.g., setting 1090 CMake-level target properties or install rules). This function returns the real 1091 target for a module. 1093 function (_vtk_module_real_target var module) 1099 set(_vtk_real_target_res "") 1100 if (TARGET "${module}
") 1101 get_property(_vtk_real_target_imported 1104 if (_vtk_real_target_imported) 1105 set(_vtk_real_target_res "${module}
") 1109 if (NOT _vtk_real_target_res) 1110 get_property(_vtk_real_target_res GLOBAL 1111 PROPERTY "_vtk_module_${module}_target_name
") 1112 # Querying during the build. 1113 if (DEFINED _vtk_build_BUILD_WITH_KITS AND _vtk_build_BUILD_WITH_KITS) 1114 get_property(_vtk_real_target_kit GLOBAL 1115 PROPERTY "_vtk_module_${module}_kit
") 1116 if (_vtk_real_target_kit) 1117 set(_vtk_real_target_res "${_vtk_real_target_res}-objects
") 1119 # A query for after the module is built. 1120 elseif (TARGET "${_vtk_real_target_res}-objects
") 1121 set(_vtk_real_target_res "${_vtk_real_target_res}-objects
") 1125 if (NOT _vtk_real_target_res) 1126 set(_vtk_real_target_msg "") 1127 if (NOT TARGET "${module}
") 1128 if (DEFINED _vtk_build_module) 1129 set(_vtk_real_target_msg 1130 " Is a module dependency missing?
") 1132 set(_vtk_real_target_msg 1133 " Is a `find_package` missing a required
component?
") 1137 "Failed to determine the real
target for the `${module}`
" 1138 "module.${_vtk_real_target_msg}
") 1142 "${_vtk_real_target_res}
" 1147 @ingroup module-internal 1148 @brief The real target for a kit 1151 _vtk_module_real_target_kit(<var> <kit>) 1154 Sometimes the actual, core target for a module is required (e.g., setting 1155 CMake-level target properties or install rules). This function returns the real 1158 function (_vtk_module_real_target_kit var kit) 1164 set(_vtk_real_target_res "") 1165 if (TARGET "${kit}
") 1166 get_property(_vtk_real_target_imported 1169 if (_vtk_real_target_imported) 1170 set(_vtk_real_target_res "${kit}
") 1174 if (NOT _vtk_real_target_res) 1175 get_property(_vtk_real_target_res GLOBAL 1176 PROPERTY "_vtk_kit_${kit}_target_name
") 1179 if (NOT _vtk_real_target_res) 1181 "Failed to determine the real
target for the `${kit}` kit.
") 1185 "${_vtk_real_target_res}
" 1191 @brief Set multiple properties on a module 1193 A wrapper around `set_target_properties` that works for modules. 1196 vtk_module_set_properties(<module> 1197 [<property> <value>]...) 1200 function (vtk_module_set_properties module) 1201 _vtk_module_real_target(_vtk_set_properties_target "${module}
") 1203 set_target_properties("${_vtk_set_properties_target}
" 1210 @brief Set a property on a module 1212 A wrapper around `set_property(TARGET)` that works for modules. 1215 vtk_module_set_property(<module> 1216 [APPEND] [APPEND_STRING] 1221 function (vtk_module_set_property module) 1222 cmake_parse_arguments(_vtk_property 1223 "APPEND;APPEND_STRING
" 1228 if (_vtk_property_UNPARSED_ARGUMENTS) 1231 "${_vtk_property_UNPARSED_ARGUMENTS}.
") 1234 if (NOT DEFINED _vtk_property_PROPERTY) 1236 "The `PROPERTY` argument is required.
") 1239 if (NOT DEFINED _vtk_property_VALUE) 1241 "The `VALUE` argument is required.
") 1244 if (_vtk_property_APPEND AND _vtk_property_APPEND_STRING) 1246 "`APPEND` and `APPEND_STRING` may not be used at the same
time.
") 1249 set(_vtk_property_args) 1250 if (_vtk_property_APPEND) 1251 list(APPEND _vtk_property_args 1254 if (_vtk_property_APPEND_STRING) 1255 list(APPEND _vtk_property_args 1259 _vtk_module_real_target(_vtk_property_target "${module}
") 1261 set_property(TARGET "${_vtk_property_target}
" 1262 ${_vtk_property_args} 1264 "${_vtk_property_PROPERTY}
" "${_vtk_property_VALUE}
") 1269 @brief Get a property from a module 1271 A wrapper around `get_property(TARGET)` that works for modules. 1274 vtk_module_get_property(<module> 1276 VARIABLE <variable>) 1279 The variable name passed to the `VARIABLE` argument will be unset if the 1280 property is not set (rather than the empty string). 1282 function (vtk_module_get_property module) 1283 cmake_parse_arguments(_vtk_property 1289 if (_vtk_property_UNPARSED_ARGUMENTS) 1292 "${_vtk_property_UNPARSED_ARGUMENTS}.
") 1295 if (NOT DEFINED _vtk_property_PROPERTY) 1297 "The `PROPERTY` argument is required.
") 1300 if (NOT DEFINED _vtk_property_VARIABLE) 1302 "The `VARIABLE` argument is required.
") 1305 _vtk_module_real_target(_vtk_property_target "${module}
") 1307 get_property(_vtk_property_is_set 1308 TARGET "${_vtk_property_target}
" 1309 PROPERTY "${_vtk_property_PROPERTY}
" 1311 if (_vtk_property_is_set) 1312 get_property(_vtk_property_value 1313 TARGET "${_vtk_property_target}
" 1314 PROPERTY "${_vtk_property_PROPERTY}
") 1316 set("${_vtk_property_VARIABLE}
" 1317 "${_vtk_property_value}
" 1320 unset("${_vtk_property_VARIABLE}
" 1326 @ingroup module-impl 1327 @brief Generate arguments for target function wrappers 1329 Create the `INTERFACE`, `PUBLIC`, and `PRIVATE` arguments for a function 1330 wrapping CMake's `target_` functions to call the wrapped function. 1332 This is necessary because not all of the functions support empty lists given a 1335 function (_vtk_module_target_function prefix) 1336 foreach (visibility IN ITEMS INTERFACE PUBLIC PRIVATE) 1337 if (${prefix}_${visibility}) 1338 set("${prefix}_${visibility}_args
" 1340 ${${prefix}_${visibility}} 1348 @brief Add dependencies to a module 1350 A wrapper around `add_dependencies` that works for modules. 1353 vtk_module_depend(<module> <depend>...) 1356 function (vtk_module_depend module) 1357 _vtk_module_real_target(_vtk_depend_target "${module}
") 1359 add_dependencies("${_vtk_depend_target}
" 1365 @brief Add include directories to a module 1367 A wrapper around `add_dependencies` that works for modules. 1370 vtk_module_include(<module> 1372 [PUBLIC <directory>...] 1373 [PRIVATE <directory>...] 1374 [INTERFACE <directory>...]) 1377 function (vtk_module_include module) 1378 cmake_parse_arguments(_vtk_include 1381 "INTERFACE;PUBLIC;PRIVATE
" 1384 if (_vtk_include_UNPARSED_ARGUMENTS) 1387 "${_vtk_include_UNPARSED_ARGUMENTS}.
") 1390 _vtk_module_real_target(_vtk_include_target "${module}
") 1391 _vtk_module_target_function(_vtk_include) 1393 set(_vtk_include_system_arg) 1394 if (_vtk_include_SYSTEM) 1395 set(_vtk_include_system_arg SYSTEM) 1398 target_include_directories("${_vtk_include_target}
" 1399 ${_vtk_include_system_arg} 1400 ${_vtk_include_INTERFACE_args} 1401 ${_vtk_include_PUBLIC_args} 1402 ${_vtk_include_PRIVATE_args}) 1407 @brief Add compile definitions to a module 1409 A wrapper around `target_compile_definitions` that works for modules. 1412 vtk_module_definitions(<module> 1413 [PUBLIC <directory>...] 1414 [PRIVATE <directory>...] 1415 [INTERFACE <directory>...]) 1418 function (vtk_module_definitions module) 1419 cmake_parse_arguments(_vtk_definitions 1422 "INTERFACE;PUBLIC;PRIVATE
" 1425 if (_vtk_definitions_UNPARSED_ARGUMENTS) 1428 "${_vtk_definitions_UNPARSED_ARGUMENTS}.
") 1431 _vtk_module_real_target(_vtk_definitions_target "${module}
") 1432 _vtk_module_target_function(_vtk_definitions) 1434 target_compile_definitions("${_vtk_definitions_target}
" 1435 ${_vtk_definitions_INTERFACE_args} 1436 ${_vtk_definitions_PUBLIC_args} 1437 ${_vtk_definitions_PRIVATE_args}) 1442 @brief Add compile options to a module 1444 A wrapper around `target_compile_options` that works for modules. 1447 vtk_module_compile_options(<module> 1448 [PUBLIC <directory>...] 1449 [PRIVATE <directory>...] 1450 [INTERFACE <directory>...]) 1453 function (vtk_module_compile_options module) 1454 cmake_parse_arguments(_vtk_compile_options 1457 "INTERFACE;PUBLIC;PRIVATE
" 1460 if (_vtk_compile_options_UNPARSED_ARGUMENTS) 1463 "${_vtk_compile_options_UNPARSED_ARGUMENTS}.
") 1466 _vtk_module_real_target(_vtk_compile_options_target "${module}
") 1467 _vtk_module_target_function(_vtk_compile_options) 1469 target_compile_options("${_vtk_compile_options_target}
" 1470 ${_vtk_compile_options_INTERFACE_args} 1471 ${_vtk_compile_options_PUBLIC_args} 1472 ${_vtk_compile_options_PRIVATE_args}) 1477 @brief Add compile features to a module 1479 A wrapper around `target_compile_features` that works for modules. 1482 vtk_module_compile_features(<module> 1483 [PUBLIC <directory>...] 1484 [PRIVATE <directory>...] 1485 [INTERFACE <directory>...]) 1488 function (vtk_module_compile_features module) 1489 cmake_parse_arguments(_vtk_compile_features 1492 "INTERFACE;PUBLIC;PRIVATE
" 1495 if (_vtk_compile_features_UNPARSED_ARGUMENTS) 1498 "${_vtk_compile_features_UNPARSED_ARGUMENTS}.
") 1501 _vtk_module_real_target(_vtk_compile_features_target "${module}
") 1502 _vtk_module_target_function(_vtk_compile_features) 1504 target_compile_features("${_vtk_compile_features_target}
" 1505 ${_vtk_compile_features_INTERFACE_args} 1506 ${_vtk_compile_features_PUBLIC_args} 1507 ${_vtk_compile_features_PRIVATE_args}) 1512 @brief Add link libraries to a module 1514 A wrapper around `target_link_libraries` that works for modules. Note that this 1515 function does extra work in kit builds, so circumventing it may break in kit 1519 vtk_module_link(<module> 1520 [PUBLIC <directory>...] 1521 [PRIVATE <directory>...] 1522 [INTERFACE <directory>...]) 1525 function (vtk_module_link module) 1526 cmake_parse_arguments(_vtk_link 1529 "INTERFACE;PUBLIC;PRIVATE
" 1532 if (_vtk_link_UNPARSED_ARGUMENTS) 1535 "${_vtk_link_UNPARSED_ARGUMENTS}.
") 1538 _vtk_module_real_target(_vtk_link_target "${module}
") 1539 _vtk_module_target_function(_vtk_link) 1541 get_property(_vtk_link_kit GLOBAL 1542 PROPERTY "_vtk_module_${module}_kit
") 1543 if (_vtk_link_kit AND NOT CMAKE_VERSION VERSION_LESS "3.12
") 1544 foreach (_vtk_link_private IN LISTS _vtk_link_PRIVATE) 1545 if (NOT TARGET "${_vtk_link_private}
") 1549 get_property(_vtk_link_private_imported 1550 TARGET "${_vtk_link_private}
" 1552 if (_vtk_link_private_imported) 1553 get_property(_vtk_link_private_imported_global 1554 TARGET "${_vtk_link_private}
" 1555 PROPERTY IMPORTED_GLOBAL) 1556 if (NOT _vtk_link_private_imported_global) 1557 set_property(TARGET "${_vtk_link_private}
" 1559 IMPORTED_GLOBAL TRUE) 1563 set_property(GLOBAL APPEND 1565 "_vtk_kit_${_vtk_link_kit}_private_links
" ${_vtk_link_PRIVATE}) 1568 target_link_libraries("${_vtk_link_target}
" 1569 ${_vtk_link_INTERFACE_args} 1570 ${_vtk_link_PUBLIC_args} 1571 ${_vtk_link_PRIVATE_args}) 1576 @brief Add link options to a module 1578 A wrapper around `target_link_options` that works for modules. 1581 vtk_module_link_options(<module> 1582 [PUBLIC <directory>...] 1583 [PRIVATE <directory>...] 1584 [INTERFACE <directory>...]) 1587 function (vtk_module_link_options module) 1588 cmake_parse_arguments(_vtk_link_options 1591 "INTERFACE;PUBLIC;PRIVATE
" 1594 if (_vtk_link_options_UNPARSED_ARGUMENTS) 1597 "${_vtk_link_options_UNPARSED_ARGUMENTS}.
") 1600 _vtk_module_real_target(_vtk_link_options_target "${module}
") 1601 _vtk_module_target_function(_vtk_link_options) 1603 target_link_options("${_vtk_link_options_target}
" 1604 ${_vtk_link_options_INTERFACE_args} 1605 ${_vtk_link_options_PUBLIC_args} 1606 ${_vtk_link_options_PRIVATE_args}) 1610 @page module-internal-api 1612 @ingroup module-internal 1613 @section module-properties Module properties 1615 The VTK module system leverages CMake's target propagation and storage. As 1616 such, there are a number of properties added to the targets representing 1617 modules. These properties are intended for use by the module system and 1618 associated functionality. In particular, more properties may be available by 1621 @subsection module-properties-naming Naming properties 1623 When creating properties for use with the module system, they should be 1624 prefixed with `INTERFACE_vtk_module_`. The `INTERFACE_` portion is required in 1625 order to work with interface libraries. The `vtk_module_` portion is to avoid 1626 colliding with any other properties. This function assumes this naming scheme 1627 for some of its convenience features as well. 1629 Properties should be the same in the local build as well as when imported to 1632 @subsection module-properties-system VTK module system properties 1634 There are a number of properties that are used and expected by the core of the 1635 module system. These are generally module metadata (module dependencies, 1636 whether to wrap or not, etc.). The properties all have the 1637 `INTERFACE_vtk_module_` prefix mentioned in the previous section. 1639 * `third_party`: If set, the module represents a third party 1640 dependency and should be treated specially. Third party modules are very 1641 restricted and generally do not have any other properties set on them. 1642 * `exclude_wrap`: If set, the module should not be wrapped by an external 1644 * `depends`: The list of dependent modules. Language wrappers will generally 1645 require this to satisfy references to parent classes of the classes in the 1647 * `private_depends`: The list of privately dependent modules. Language 1648 wrappers may require this to satisfy references to parent classes of the 1649 classes in the module. 1650 * `optional_depends`: The list of optionally dependent modules. Language 1651 wrappers may require this to satisfy references to parent classes of the 1652 classes in the module. 1653 * `kit`: The kit the module is a member of. Only set if the module is 1654 actually a member of the kit (i.e., the module was built with 1655 `BUILD_WITH_KITS ON`). 1656 * `implements`: The list of modules for which this module registers to. This 1657 is used by the autoinit subsystem and generally is not required. 1658 * `implementable`: If set, this module provides registries which may be 1659 populated by dependent modules. It is used to check the `implements` 1660 property to help minimize unnecessary work from the autoinit subsystem. 1661 * `needs_autoinit`: If set, linking to this module requires the autoinit 1662 subsystem to ensure that registries in modules are fully populated. 1663 * `headers`: Paths to the public headers from the module. These are the 1664 headers which should be handled by language wrappers. 1665 * `hierarchy`: The path to the hierarchy file describing inheritance of the 1666 classes for use in language wrappers. 1667 * `forward_link`: Usage requirements that must be forwarded even though the 1668 module is linked to privately. 1670 Kits have the following properties available (but only if kits are enabled): 1672 * `kit_modules`: Modules which are compiled into the kit. 1676 @ingroup module-internal 1677 @brief Set a module property 1679 This function sets a [module property](@ref module-properties) on a module. The 1680 required prefix will automatically be added to the passed name. 1683 _vtk_module_set_module_property(<module> 1684 [APPEND] [APPEND_STRING] 1689 function (_vtk_module_set_module_property module) 1690 cmake_parse_arguments(_vtk_property 1691 "APPEND;APPEND_STRING
" 1696 if (_vtk_property_UNPARSED_ARGUMENTS) 1698 "Unparsed arguments
for vtk_module_set_module_property:
" 1699 "${_vtk_property_UNPARSED_ARGUMENTS}.
") 1702 if (NOT DEFINED _vtk_property_PROPERTY) 1704 "The `PROPERTY` argument is required.
") 1707 if (NOT DEFINED _vtk_property_VALUE) 1709 "The `VALUE` argument is required.
") 1712 if (_vtk_property_APPEND AND _vtk_property_APPEND_STRING) 1714 "`APPEND` and `APPEND_STRING` may not be used at the same
time.
") 1717 set(_vtk_property_args) 1718 if (_vtk_property_APPEND) 1719 list(APPEND _vtk_property_args 1722 if (_vtk_property_APPEND_STRING) 1723 list(APPEND _vtk_property_args 1727 get_property(_vtk_property_is_alias 1729 PROPERTY ALIASED_TARGET 1731 if (_vtk_property_is_alias) 1732 _vtk_module_real_target(_vtk_property_target "${module}
") 1734 set(_vtk_property_target "${module}
") 1737 set_property(TARGET "${_vtk_property_target}
" 1738 ${_vtk_property_args} 1740 "INTERFACE_vtk_module_${_vtk_property_PROPERTY}
" "${_vtk_property_VALUE}
") 1744 @ingroup module-internal 1745 @brief Get a module property 1747 Get a [module property](@ref module-properties) from a module. 1750 _vtk_module_get_module_property(<module> 1752 VARIABLE <variable>) 1755 As with @ref vtk_module_get_property, the output variable will be unset if the 1756 property is not set. The property name is automatically prepended with the 1759 function (_vtk_module_get_module_property module) 1760 cmake_parse_arguments(_vtk_property 1766 if (_vtk_property_UNPARSED_ARGUMENTS) 1768 "Unparsed arguments
for vtk_module_get_module_property:
" 1769 "${_vtk_property_UNPARSED_ARGUMENTS}.
") 1772 if (NOT DEFINED _vtk_property_PROPERTY) 1774 "The `PROPERTY` argument is required.
") 1777 if (NOT DEFINED _vtk_property_VARIABLE) 1779 "The `VARIABLE` argument is required.
") 1782 get_property(_vtk_property_is_alias 1784 PROPERTY ALIASED_TARGET 1786 if (_vtk_property_is_alias) 1787 _vtk_module_real_target(_vtk_property_target "${module}
") 1789 set(_vtk_property_target "${module}
") 1792 get_property(_vtk_property_is_set 1793 TARGET "${_vtk_property_target}
" 1794 PROPERTY "INTERFACE_vtk_module_${_vtk_property_PROPERTY}
" 1796 if (_vtk_property_is_set) 1797 get_property(_vtk_property_value 1798 TARGET "${_vtk_property_target}
" 1799 PROPERTY "INTERFACE_vtk_module_${_vtk_property_PROPERTY}
") 1801 set("${_vtk_property_VARIABLE}
" 1802 "${_vtk_property_value}
" 1805 unset("${_vtk_property_VARIABLE}
" 1811 @ingroup module-internal 1812 @brief Check that destinations are valid 1814 All installation destinations are expected to be relative so that 1815 `CMAKE_INSTALL_PREFIX` can be relied upon in all code paths. This function may 1816 be used to verify that destinations are relative. 1819 _vtk_module_check_destinations(<prefix> [<suffix>...]) 1822 For each `suffix`, `prefix` is prefixed to it and the resulting variable name 1823 is checked for validity as an install prefix. Raises an error if any is 1826 function (_vtk_module_check_destinations prefix) 1827 foreach (suffix IN LISTS ARGN) 1828 if (IS_ABSOLUTE "${${prefix}${suffix}}
") 1830 "The `${suffix}` must not be an absolute path. Use
" 1831 "`CMAKE_INSTALL_PREFIX` to keep everything in a single installation
" 1838 @ingroup module-internal 1839 @brief Write an import prefix statement 1841 CMake files, once installed, may need to construct paths to other locations 1842 within the install prefix. This function writes a prefix computation for file 1843 given its install destination. 1846 _vtk_module_write_import_prefix(<file> <destination>) 1849 The passed file is cleared so that it occurs at the top of the file. The prefix 1850 is available in the file as the `_vtk_module_import_prefix` variable. It is 1851 recommended to unset the variable at the end of the file. 1853 function (_vtk_module_write_import_prefix file destination) 1854 if (IS_ABSOLUTE "${destination}
") 1856 "An
import prefix cannot be determined from an absolute installation
" 1857 "destination. Use `CMAKE_INSTALL_PREFIX` to keep everything in a single
" 1858 "installation prefix.
") 1861 file(WRITE "${file}
" 1862 "set(_vtk_module_import_prefix \
"\${CMAKE_CURRENT_LIST_DIR}\")\n")
1864 get_filename_component(destination
"${destination}" DIRECTORY)
1865 file(APPEND
"${file}" 1866 "get_filename_component(_vtk_module_import_prefix \"\${_vtk_module_import_prefix}\" DIRECTORY)\n")
1871 @ingroup module-
internal 1872 @brief Export properties
on modules and targets
1874 This
function is intended
for use in support functions which leverage the
1875 module system, not by general system users. This
function supports exporting
1876 properties from the build into dependencies via
target properties which are
1877 loaded from a project
's config file which is loaded via CMake's `find_package`
1886 [PROPERTIES <property>...]
1887 [FROM_GLOBAL_PROPERTIES <property fragment>...]
1888 [SPLIT_INSTALL_PROPERTIES <property fragment>...])
1891 The `BUILD_FILE` and `INSTALL_FILE` arguments are required. Exactly one of
1892 `MODULE` and `KIT` is also required. The `MODULE` or `KIT` argument holds the
1893 name of the module or kit that will have properties exported. The `BUILD_FILE`
1894 and `INSTALL_FILE` paths are *appended to*. As such, when setting up these
1895 files, it should be preceded with:
1898 file(WRITE
"${build_file}")
1899 file(WRITE
"${install_file}")
1902 To avoid accidental usage of the install file from the build tree, it is
1903 recommended to store it under a `CMakeFiles/` directory in the build tree with
1904 an additional `.install` suffix and use `install(RENAME)` to rename it at
1907 The
set of properties exported is computed as follows:
1909 * `PROPERTIES` queries the module
target for the given
property and exports
1910 its
value as-is to both the build and install files. In addition, these
1911 properties are
set on the
target directly as the same
name.
1912 * `FROM_GLOBAL_PROPERTIES` queries the
global 1913 `_vtk_module_<MODULE>_<fragment>`
property and exports it to both the build
1914 and install files as `INTERFACE_vtk_module_<fragment>`.
1915 * `SPLIT_INSTALL_PROPERTIES` queries the
target for 1916 `INTERFACE_vtk_module_<fragment>` and exports its
value to the build file
1917 and `INTERFACE_vtk_module_<fragment>_install` to the install file as the
1918 non-install
property name. This is generally useful
for properties which
1919 change between the build and installation.
1922 cmake_parse_arguments(_vtk_export_properties
1924 "BUILD_FILE;INSTALL_FILE;MODULE;KIT" 1925 "FROM_GLOBAL_PROPERTIES;PROPERTIES;SPLIT_INSTALL_PROPERTIES" 1928 if (_vtk_export_properties_UNPARSED_ARGUMENTS)
1930 "Unparsed arguments for _vtk_export_properties: " 1931 "${_vtk_export_properties_UNPARSED_ARGUMENTS}.")
1934 if (DEFINED _vtk_export_properties_MODULE)
1935 if (DEFINED _vtk_export_properties_KIT)
1937 "Only one of `MODULE` or `KIT` is required to export properties.")
1939 set(_vtk_export_properties_type "module")
1940 set(_vtk_export_properties_name "${_vtk_export_properties_MODULE}
") 1941 elseif (_vtk_export_properties_KIT) 1942 set(_vtk_export_properties_type "kit
") 1943 set(_vtk_export_properties_name "${_vtk_export_properties_KIT}
") 1946 "A module or kit is required to export properties.
") 1949 if (NOT _vtk_export_properties_BUILD_FILE) 1951 "Exporting properties requires a build file to write to.
") 1954 if (NOT _vtk_export_properties_INSTALL_FILE) 1956 "Exporting properties requires an install file to write to.
") 1959 if (_vtk_export_properties_type STREQUAL "module
") 1960 _vtk_module_real_target(_vtk_export_properties_target_name "${_vtk_export_properties_name}
") 1961 elseif (_vtk_export_properties_type STREQUAL "kit
") 1962 _vtk_module_real_target_kit(_vtk_export_properties_target_name "${_vtk_export_properties_name}
") 1965 foreach (_vtk_export_properties_global IN LISTS _vtk_export_properties_FROM_GLOBAL_PROPERTIES) 1966 get_property(_vtk_export_properties_is_set GLOBAL 1967 PROPERTY "_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_name}_${_vtk_export_properties_global}
" 1969 if (NOT _vtk_export_properties_is_set) 1973 get_property(_vtk_export_properties_value GLOBAL 1974 PROPERTY "_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_name}_${_vtk_export_properties_global}
") 1975 set(_vtk_export_properties_set_property 1976 "set_property(TARGET \
"${_vtk_export_properties_name}\" PROPERTY \"INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_global}\" \"${_vtk_export_properties_value}\")\n")
1978 set_property(TARGET
"${_vtk_export_properties_target_name}" 1980 "INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_global}" "${_vtk_export_properties_value}")
1981 file(APPEND
"${_vtk_export_properties_BUILD_FILE}" 1982 "${_vtk_export_properties_set_property}")
1983 file(APPEND
"${_vtk_export_properties_INSTALL_FILE}" 1984 "${_vtk_export_properties_set_property}")
1987 foreach (_vtk_export_properties_target IN LISTS _vtk_export_properties_PROPERTIES)
1988 get_property(_vtk_export_properties_is_set
1989 TARGET "${_vtk_export_properties_target_name}
" 1990 PROPERTY "${_vtk_export_properties_target}
" 1992 if (NOT _vtk_export_properties_is_set) 1996 get_property(_vtk_export_properties_value 1997 TARGET "${_vtk_export_properties_target_name}
" 1998 PROPERTY "${_vtk_export_properties_target}
") 1999 set(_vtk_export_properties_set_property 2000 "set_property(TARGET \
"${_vtk_export_properties_name}\" PROPERTY \"${_vtk_export_properties_target}\" \"${_vtk_export_properties_value}\")\n")
2002 file(APPEND
"${_vtk_export_properties_BUILD_FILE}" 2003 "${_vtk_export_properties_set_property}")
2004 file(APPEND
"${_vtk_export_properties_INSTALL_FILE}" 2005 "${_vtk_export_properties_set_property}")
2008 foreach (_vtk_export_properties_split IN LISTS _vtk_export_properties_SPLIT_INSTALL_PROPERTIES)
2009 get_property(_vtk_export_properties_is_set
2010 TARGET "${_vtk_export_properties_target_name}
" 2011 PROPERTY "INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_split}
" 2013 if (NOT _vtk_export_properties_is_set) 2017 get_property(_vtk_export_properties_value 2018 TARGET "${_vtk_export_properties_target_name}
" 2019 PROPERTY "INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_split}
") 2020 set(_vtk_export_properties_set_property 2021 "set_property(TARGET \
"${_vtk_export_properties_name}\" PROPERTY \"INTERFACE_vtk_module_${_vtk_export_properties_split}\" \"${_vtk_export_properties_value}\")\n")
2022 file(APPEND
"${_vtk_export_properties_BUILD_FILE}" 2023 "${_vtk_export_properties_set_property}")
2025 get_property(_vtk_export_properties_value
2026 TARGET
"${_vtk_export_properties_target_name}" 2027 PROPERTY
"INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_split}_install")
2028 set(_vtk_export_properties_set_property
2029 "set_property(TARGET \"${_vtk_export_properties_name}\" PROPERTY \"INTERFACE_vtk_module_${_vtk_export_properties_split}\" \"${_vtk_export_properties_value}\")\n")
2030 file(APPEND
"${_vtk_export_properties_INSTALL_FILE}" 2031 "${_vtk_export_properties_set_property}")
2035 include("${CMAKE_CURRENT_LIST_DIR}/vtkModuleTesting.cmake
") 2039 @brief Build modules and kits 2041 Once all of the modules have been scanned, they need to be built. Generally, 2042 there will be just one build necessary for a set of scans, though they may be 2043 built distinctly as well. If there are multiple calls to this function, they 2044 should generally in reverse order of their scans. 2051 [LIBRARY_NAME_SUFFIX <suffix>] 2053 [SOVERSION <soversion>] 2057 [BUILD_WITH_KITS <ON|OFF>] 2059 [ENABLE_WRAPPING <ON|OFF>] 2061 [USE_EXTERNAL <ON|OFF>] 2063 [INSTALL_HEADERS <ON|OFF>] 2064 [HEADERS_COMPONENT <component>] 2066 [TARGETS_COMPONENT <component>] 2067 [INSTALL_EXPORT <export>] 2069 [TEST_DIRECTORY_NAME <name>] 2070 [TEST_DATA_TARGET <target>] 2071 [TEST_INPUT_DATA_DIRECTORY <directory>] 2072 [TEST_OUTPUT_DATA_DIRECTORY <directory>] 2073 [TEST_OUTPUT_DIRECTORY <directory>] 2075 [ARCHIVE_DESTINATION <destination>] 2076 [HEADERS_DESTINATION <destination>] 2077 [LIBRARY_DESTINATION <destination>] 2078 [RUNTIME_DESTINATION <destination>] 2079 [CMAKE_DESTINATION <destination>] 2080 [LICENSE_DESTINATION <destination>] 2081 [HIERARCHY_DESTINATION <destination>]) 2084 The only requirement of the function is the list of modules to build, the rest 2085 have reasonable defaults if not specified. 2087 * `MODULES`: (Required) The list of modules to build. 2088 * `KITS`: (Required if `BUILD_WITH_KITS` is `ON`) The list of kits to build. 2089 * `LIBRARY_NAME_SUFFIX`: (Defaults to `""`) A suffix to add to library names. 2090 If it is not empty, it is prefixed with `-` to separate it from the kit 2092 * `VERSION`: If specified, the `VERSION` property on built libraries will be 2094 * `SOVERSION`: If specified, the `SOVERSION` property on built libraries will 2095 be set to this value. 2096 * `PACKAGE`: (Defaults to `${CMAKE_PROJECT_NAME}`) The name the build is 2097 meant to be found as when using `find_package`. Note that separate builds 2098 will require distinct `PACKAGE` values. 2099 * `BUILD_WITH_KITS`: (Defaults to `OFF`) If enabled, kit libraries will be 2101 * `ENABLE_WRAPPING`: (Default depends on the existence of 2102 `VTK::WrapHierarchy` or `VTKCompileTools::WrapHierarchy` targets) If 2103 enabled, wrapping will be available to the modules built in this call. 2104 * `USE_EXTERNAL`: (Defaults to `OFF`) Whether third party modules should find 2105 external copies rather than building their own copy. 2106 * `INSTALL_HEADERS`: (Defaults to `ON`) Whether or not to install public headers. 2107 * `HEADERS_COMPONENT`: (Defaults to `development`) The install component to 2108 use for header installation. Note that other SDK-related bits use the same 2109 component (e.g., CMake module files). 2110 * `TARGETS_COMPONENT`: `Defaults to `runtime`) The install component to use 2111 for the libraries built. 2112 * `TARGET_NAMESPACE`: `Defaults to `<AUTO>`) The namespace for installed 2113 targets. All targets must have the same namespace. If set to `<AUTO>`, 2114 the namespace will be detected automatically. 2115 * `INSTALL_EXPORT`: (Defaults to `""`) If non-empty, targets will be added to 2116 the given export. The export will also be installed as part of this build 2118 * `TEST_DIRECTORY_NAME`: (Defaults to `Testing`) The name of the testing 2119 directory to look for in each module. Set to `NONE` to disable automatic 2121 * `TEST_DATA_TARGET`: (Defaults to `<PACKAGE>-data`) The target to add 2122 testing data download commands to. 2123 * `TEST_INPUT_DATA_DIRECTORY`: (Defaults to 2124 `${CMAKE_CURRENT_SOURCE_DIR}/Data`) The directory which will contain data 2126 * `TEST_OUTPUT_DATA_DIRECTORY`: (Defaults to 2127 `${CMAKE_CURRENT_BINARY_DIR}/Data`) The directory which will contain data 2129 * `TEST_OUTPUT_DIRECTORY`: (Defaults to 2130 `${CMAKE_BINARY_DIR}/<TEST_DIRECTORY_NAME>/Temporary`) The directory which 2131 tests may write any output files to. 2133 The remaining arguments control where to install files related to the build. 2134 See CMake documentation for the difference between `ARCHIVE`, `LIBRARY`, and 2137 * `ARCHIVE_DESTINATION`: (Defaults to `${CMAKE_INSTALL_LIBDIR}`) The install 2138 destination for archive files. 2139 * `HEADERS_DESTINATION`: (Defaults to `${CMAKE_INSTALL_INCLUDEDIR}`) The 2140 install destination for header files. 2141 * `LIBRARY_DESTINATION`: (Defaults to `${CMAKE_INSTALL_LIBDIR}`) The install 2142 destination for library files. 2143 * `RUNTIME_DESTINATION`: (Defaults to `${CMAKE_INSTALL_BINDIR}`) The install 2144 destination for runtime files. 2145 * `CMAKE_DESTINATION`: (Defaults to `<library destination>/cmake/<package>`) 2146 The install destination for CMake files. 2147 * `LICENSE_DESTINATION`: (Defaults to `${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}`) 2148 The install destination for license files (relevant for third party 2150 * `HIERARCHY_DESTINATION`: (Defaults to `<library 2151 destination>/vtk/hierarchy/<PACKAGE>`) The install destination 2152 for hierarchy files (used for language wrapping). 2154 function (vtk_module_build) 2155 set(_vtk_build_install_arguments 2172 HIERARCHY_DESTINATION) 2173 set(_vtk_build_test_arguments 2177 TEST_INPUT_DATA_DIRECTORY 2178 TEST_OUTPUT_DATA_DIRECTORY 2179 TEST_OUTPUT_DIRECTORY) 2181 # TODO: Add an option to build statically? Currently, `BUILD_SHARED_LIBS` is 2184 cmake_parse_arguments(_vtk_build 2186 "BUILD_WITH_KITS;USE_EXTERNAL;LIBRARY_NAME_SUFFIX;VERSION;SOVERSION;PACKAGE;ENABLE_WRAPPING;${_vtk_build_install_arguments};${_vtk_build_test_arguments}
" 2190 if (_vtk_build_UNPARSED_ARGUMENTS) 2193 "${_vtk_build_UNPARSED_ARGUMENTS}
") 2196 if (NOT DEFINED _vtk_build_USE_EXTERNAL) 2197 set(_vtk_build_USE_EXTERNAL OFF) 2200 if (NOT DEFINED _vtk_build_PACKAGE) 2201 set(_vtk_build_PACKAGE "${CMAKE_PROJECT_NAME}
") 2203 get_property(_vtk_build_package_exists GLOBAL 2204 PROPERTY "_vtk_module_package_${_vtk_build_PACKAGE}
" 2206 if (_vtk_build_package_exists) 2208 "A
set of modules have already been built
using the
" 2209 "`${_vtk_build_PACKAGE}` package.
") 2213 "_vtk_module_package_${_vtk_build_PACKAGE}
" "ON
") 2216 if (NOT DEFINED _vtk_build_INSTALL_HEADERS) 2217 set(_vtk_build_INSTALL_HEADERS ON) 2220 if (NOT DEFINED _vtk_build_ENABLE_WRAPPING) 2221 if (TARGET "VTKCompileTools::WrapHierarchy
" OR 2222 TARGET "VTK::WrapHierarchy
") 2223 set(_vtk_build_ENABLE_WRAPPING ON) 2225 set(_vtk_build_ENABLE_WRAPPING OFF) 2229 if (NOT DEFINED _vtk_build_TARGET_NAMESPACE) 2230 set(_vtk_build_TARGET_NAMESPACE "<AUTO>
") 2233 if (NOT DEFINED _vtk_build_BUILD_WITH_KITS) 2234 set(_vtk_build_BUILD_WITH_KITS OFF) 2237 if (_vtk_build_BUILD_WITH_KITS AND CMAKE_VERSION VERSION_LESS "3.12
") 2239 "Building with kits
enabled requires CMake 3.12 which introduced
" 2240 "support
for OBJECT libraries to have and utilize usage requirements.
") 2243 if (_vtk_build_BUILD_WITH_KITS AND NOT DEFINED _vtk_build_KITS) 2245 "Building with kits was requested, but no kits were specified.
") 2248 if (NOT DEFINED _vtk_build_TEST_DIRECTORY_NAME) 2249 set(_vtk_build_TEST_DIRECTORY_NAME "Testing
") 2252 if (NOT DEFINED _vtk_build_TEST_DATA_TARGET) 2253 set(_vtk_build_TEST_DATA_TARGET "${_vtk_build_PACKAGE}-
data") 2256 if (NOT DEFINED _vtk_build_TEST_INPUT_DATA_DIRECTORY) 2257 set(_vtk_build_TEST_INPUT_DATA_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Data
") 2260 if (NOT DEFINED _vtk_build_TEST_OUTPUT_DATA_DIRECTORY) 2261 set(_vtk_build_TEST_OUTPUT_DATA_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Data
") 2264 if (NOT DEFINED _vtk_build_TEST_OUTPUT_DIRECTORY) 2265 set(_vtk_build_TEST_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_vtk_build_TEST_DIRECTORY_NAME}/Temporary
") 2268 if (NOT DEFINED _vtk_build_HEADERS_COMPONENT) 2269 set(_vtk_build_HEADERS_COMPONENT "development
") 2272 if (NOT DEFINED _vtk_build_ARCHIVE_DESTINATION) 2273 set(_vtk_build_ARCHIVE_DESTINATION "${CMAKE_INSTALL_LIBDIR}
") 2276 if (NOT DEFINED _vtk_build_HEADERS_DESTINATION) 2277 set(_vtk_build_HEADERS_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}
") 2280 if (NOT DEFINED _vtk_build_LIBRARY_DESTINATION) 2281 set(_vtk_build_LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}
") 2284 if (NOT DEFINED _vtk_build_RUNTIME_DESTINATION) 2285 set(_vtk_build_RUNTIME_DESTINATION "${CMAKE_INSTALL_BINDIR}
") 2288 if (NOT DEFINED _vtk_build_CMAKE_DESTINATION) 2289 set(_vtk_build_CMAKE_DESTINATION "${_vtk_build_LIBRARY_DESTINATION}/cmake/${_vtk_build_PACKAGE}
") 2292 if (NOT DEFINED _vtk_build_LICENSE_DESTINATION) 2293 set(_vtk_build_LICENSE_DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}
") 2296 if (NOT DEFINED _vtk_build_HIERARCHY_DESTINATION) 2297 set(_vtk_build_HIERARCHY_DESTINATION "${_vtk_build_LIBRARY_DESTINATION}/
vtk/hierarchy/${_vtk_build_PACKAGE}
") 2300 if (NOT DEFINED _vtk_build_TARGETS_COMPONENT) 2301 set(_vtk_build_TARGETS_COMPONENT "runtime
") 2304 if (NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) 2305 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_vtk_build_ARCHIVE_DESTINATION}
") 2307 if (NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) 2308 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_vtk_build_LIBRARY_DESTINATION}
") 2310 if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) 2311 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_vtk_build_RUNTIME_DESTINATION}
") 2314 if (NOT _vtk_build_MODULES) 2316 "No modules given to build.
") 2319 _vtk_module_check_destinations(_vtk_build_ 2325 HIERARCHY_DESTINATION) 2327 foreach (_vtk_build_module IN LISTS _vtk_build_MODULES) 2328 get_property("_vtk_build_${_vtk_build_module}_depends
" GLOBAL 2329 PROPERTY "_vtk_module_${_vtk_build_module}_depends
") 2330 get_property("_vtk_build_${_vtk_build_module}_private_depends
" GLOBAL 2331 PROPERTY "_vtk_module_${_vtk_build_module}_private_depends
") 2332 get_property("_vtk_build_${_vtk_build_module}_optional_depends
" GLOBAL 2333 PROPERTY "_vtk_module_${_vtk_build_module}_optional_depends
") 2334 get_property("_vtk_build_${_vtk_build_module}_order_depends
" GLOBAL 2335 PROPERTY "_vtk_module_${_vtk_build_module}_order_depends
") 2336 set("_vtk_build_${_vtk_build_module}_all_depends
" 2337 ${_vtk_build_${_vtk_build_module}_depends} 2338 ${_vtk_build_${_vtk_build_module}_private_depends} 2339 ${_vtk_build_${_vtk_build_module}_optional_depends} 2340 ${_vtk_build_${_vtk_build_module}_order_depends}) 2343 set(_vtk_build_sorted_modules "${_vtk_build_MODULES}
") 2344 vtk_topological_sort(_vtk_build_sorted_modules "_vtk_build_
" "_all_depends
") 2346 foreach (_vtk_build_module IN LISTS _vtk_build_sorted_modules) 2347 if (NOT _vtk_build_module IN_LIST _vtk_build_MODULES) 2351 if (TARGET "${_vtk_build_module}
") 2352 get_property(_vtk_build_is_imported 2353 TARGET "${_vtk_build_module}
" 2356 # TODO: Is this right? 2357 if (NOT _vtk_build_is_imported) 2359 "The ${_vtk_build_module} module has been requested to be built, but
" 2360 "it is already built by
this project.
") 2366 foreach (_vtk_build_depend IN LISTS "_vtk_build_${_vtk_build_module}_depends
" "_vtk_build_${_vtk_build_module}_private_depends
") 2367 if (NOT TARGET "${_vtk_build_depend}
") 2369 "The ${_vtk_build_depend} dependency is missing
for ${_vtk_build_module}.
") 2373 get_property(_vtk_build_module_file GLOBAL 2374 PROPERTY "_vtk_module_${_vtk_build_module}_file
") 2375 if (NOT _vtk_build_module_file) 2377 "The requested ${_vtk_build_module} module is not a VTK module.
") 2380 _vtk_module_debug(building "@_vtk_build_module@ is being built
") 2382 get_filename_component(_vtk_build_module_dir "${_vtk_build_module_file}
" DIRECTORY) 2383 file(RELATIVE_PATH _vtk_build_module_subdir "${CMAKE_SOURCE_DIR}
" "${_vtk_build_module_dir}
") 2385 "${CMAKE_SOURCE_DIR}/${_vtk_build_module_subdir}
" 2386 "${CMAKE_BINARY_DIR}/${_vtk_build_module_subdir}
") 2388 if (NOT TARGET "${_vtk_build_module}
") 2390 "The ${_vtk_build_module} is being built, but a matching
target was
" 2395 if (_vtk_build_BUILD_WITH_KITS) 2396 foreach (_vtk_build_kit IN LISTS _vtk_build_KITS) 2397 get_property(_vtk_build_target_name GLOBAL 2398 PROPERTY "_vtk_kit_${_vtk_build_kit}_target_name
") 2399 set(_vtk_kit_source_file 2400 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/vtk_module_kit_${_vtk_build_target_name}.c
") 2402 OUTPUT "${_vtk_kit_source_file}
" 2403 CONTENT "void vtk_module_kit_${_vtk_build_target_name}() {}\n
") 2404 add_library("${_vtk_build_target_name}
" 2405 "${_vtk_kit_source_file}
") 2406 get_property(_vtk_build_namespace GLOBAL 2407 PROPERTY "_vtk_kit_${_vtk_build_kit}_namespace
") 2408 if (_vtk_build_TARGET_NAMESPACE STREQUAL "<AUTO>
") 2409 set(_vtk_build_TARGET_NAMESPACE "${_vtk_build_namespace}
") 2411 if (NOT _vtk_build_namespace STREQUAL _vtk_build_TARGET_NAMESPACE) 2413 "The `TARGET_NAMESPACE` (${_vtk_build_TARGET_NAMESPACE}) is not the
" 2414 "same as the ${_vtk_build_kit} kit
namespace "
2415 "(${_vtk_build_namespace}).
") 2417 if (NOT _vtk_build_kit STREQUAL _vtk_build_target_name) 2418 add_library("${_vtk_build_kit}
" ALIAS 2419 "${_vtk_build_target_name}
") 2421 _vtk_module_apply_properties("${_vtk_build_target_name}
") 2422 _vtk_module_install("${_vtk_build_target_name}
") 2424 set(_vtk_build_kit_modules_object_libraries) 2425 set(_vtk_build_kit_modules_private_depends) 2427 get_property(_vtk_build_kit_modules GLOBAL 2428 PROPERTY "_vtk_kit_${_vtk_build_kit}_kit_modules
") 2429 foreach (_vtk_build_kit_module IN LISTS _vtk_build_kit_modules) 2430 get_property(_vtk_build_kit_module_target_name GLOBAL 2431 PROPERTY "_vtk_module_${_vtk_build_kit_module}_target_name
") 2432 list(APPEND _vtk_build_kit_modules_object_libraries 2433 "${_vtk_build_kit_module_target_name}-objects
") 2435 # Since there is no link step for modules, we need to copy the private 2436 # dependencies of the constituent modules into the kit so that their 2437 # private dependencies are actually linked. 2438 get_property(_vtk_build_kit_module_private_depends GLOBAL 2439 PROPERTY "_vtk_module_${_vtk_build_kit_module}_private_depends
") 2440 # Also grab optional dependencies since they end up being private 2442 get_property(_vtk_build_kit_module_optional_depends GLOBAL 2443 PROPERTY "_vtk_module_${_vtk_build_kit_module}_optional_depends
") 2444 foreach (_vtk_build_kit_module_private_depend IN LISTS _vtk_build_kit_module_private_depends _vtk_build_kit_module_optional_depends) 2445 if (NOT TARGET "${_vtk_build_kit_module_private_depend}
") 2449 # But we don't need to link to modules that are part of the kit we are 2451 if (NOT _vtk_build_kit_module_private_depend IN_LIST _vtk_build_kit_modules) 2452 list(APPEND _vtk_build_kit_modules_private_depends 2453 "$<LINK_ONLY:${_vtk_build_kit_module_private_depend}>
") 2458 get_property(_vtk_build_kit_private_links GLOBAL 2459 PROPERTY "_vtk_kit_${_vtk_build_kit}_private_links
") 2461 if (_vtk_build_kit_modules_private_depends) 2462 list(REMOVE_DUPLICATES _vtk_build_kit_modules_private_depends) 2464 if (_vtk_build_kit_modules_private_links) 2465 list(REMOVE_DUPLICATES _vtk_build_kit_modules_private_links) 2468 target_link_libraries("${_vtk_build_target_name}
" 2470 ${_vtk_build_kit_modules_object_libraries} 2471 ${_vtk_build_kit_modules_private_depends} 2472 ${_vtk_build_kit_private_links}) 2473 get_property(_vtk_build_kit_library_name GLOBAL 2474 PROPERTY "_vtk_kit_${_vtk_build_kit}_library_name
") 2475 if (_vtk_build_LIBRARY_NAME_SUFFIX) 2476 string(APPEND _vtk_build_kit_library_name "-${_vtk_build_LIBRARY_NAME_SUFFIX}
") 2478 set_target_properties("${_vtk_build_target_name}
" 2480 OUTPUT_NAME "${_vtk_build_kit_library_name}
") 2484 set(_vtk_build_properties_filename "${_vtk_build_PACKAGE}-
vtk-module-properties.cmake
") 2485 set(_vtk_build_properties_install_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_build_properties_filename}.install
") 2486 set(_vtk_build_properties_build_file "${CMAKE_BINARY_DIR}/${_vtk_build_CMAKE_DESTINATION}/${_vtk_build_properties_filename}
") 2488 file(WRITE "${_vtk_build_properties_build_file}
") 2490 _vtk_module_write_import_prefix( 2491 "${_vtk_build_properties_install_file}
" 2492 "${_vtk_build_CMAKE_DESTINATION}
") 2494 foreach (_vtk_build_module IN LISTS _vtk_build_MODULES) 2495 get_property(_vtk_build_namespace GLOBAL 2496 PROPERTY "_vtk_module_${_vtk_build_module}_namespace
") 2497 if (_vtk_build_TARGET_NAMESPACE STREQUAL "<AUTO>
") 2498 set(_vtk_build_TARGET_NAMESPACE "${_vtk_build_namespace}
") 2500 if (NOT _vtk_build_namespace STREQUAL _vtk_build_TARGET_NAMESPACE) 2502 "The `TARGET_NAMESPACE` (${_vtk_build_TARGET_NAMESPACE}) is not the
" 2503 "same as the ${_vtk_build_module} module
namespace "
2504 "(${_vtk_build_namespace}).
") 2507 get_property(_vtk_build_is_third_party 2508 TARGET "${_vtk_build_module}
" 2509 PROPERTY "INTERFACE_vtk_module_third_party
") 2510 if (_vtk_build_is_third_party) 2511 _vtk_module_export_properties( 2512 BUILD_FILE "${_vtk_build_properties_build_file}
" 2513 INSTALL_FILE "${_vtk_build_properties_install_file}
" 2514 MODULE "${_vtk_build_module}
" 2515 FROM_GLOBAL_PROPERTIES 2516 # Export the dependencies of a module. 2520 # The library name of the module. 2523 # Export whether a module is third party or not. 2524 INTERFACE_vtk_module_third_party 2525 INTERFACE_vtk_module_exclude_wrap) 2529 set(_vtk_build_split_properties) 2530 get_property(_vtk_build_exclude_wrap 2531 TARGET "${_vtk_build_module}
" 2532 PROPERTY "INTERFACE_vtk_module_${_vtk_build_module}_exclude_wrap
") 2533 if (NOT _vtk_build_exclude_wrap) 2534 list(APPEND _vtk_build_split_properties 2536 if (_vtk_build_ENABLE_WRAPPING) 2537 list(APPEND _vtk_build_split_properties 2542 set(_vtk_build_properties_kit_properties) 2543 if (_vtk_build_BUILD_WITH_KITS) 2544 list(APPEND _vtk_build_properties_kit_properties 2545 # Export the kit membership of a module. 2549 _vtk_module_export_properties( 2550 BUILD_FILE "${_vtk_build_properties_build_file}
" 2551 INSTALL_FILE "${_vtk_build_properties_install_file}
" 2552 MODULE "${_vtk_build_module}
" 2553 FROM_GLOBAL_PROPERTIES 2554 # Export whether the module should be excluded from wrapping or not. 2556 # Export the dependencies of a module. 2560 # Export what modules are implemented by the module. 2562 # Export whether the module contains autoinit logic. 2564 # The library name of the module. 2566 ${_vtk_build_properties_kit_properties} 2568 # Export whether the module needs autoinit logic handled. 2569 INTERFACE_vtk_module_needs_autoinit 2570 # Forward private usage requirements with global effects. 2571 INTERFACE_vtk_module_forward_link 2572 SPLIT_INSTALL_PROPERTIES 2573 # Set the properties which differ between build and install trees. 2574 ${_vtk_build_split_properties}) 2577 if (_vtk_build_BUILD_WITH_KITS) 2578 foreach (_vtk_build_kit IN LISTS _vtk_build_KITS) 2579 _vtk_module_export_properties( 2580 BUILD_FILE "${_vtk_build_properties_build_file}
" 2581 INSTALL_FILE "${_vtk_build_properties_install_file}
" 2582 KIT "${_vtk_build_kit}
" 2583 FROM_GLOBAL_PROPERTIES 2584 # Export the list of modules in the kit. 2589 if (_vtk_build_INSTALL_EXPORT AND _vtk_build_INSTALL_HEADERS) 2590 set(_vtk_build_namespace) 2591 if (_vtk_build_TARGET_NAMESPACE) 2592 set(_vtk_build_namespace 2593 NAMESPACE "${_vtk_build_TARGET_NAMESPACE}::
") 2597 EXPORT "${_vtk_build_INSTALL_EXPORT}
" 2598 ${_vtk_build_namespace} 2599 FILE "${CMAKE_BINARY_DIR}/${_vtk_build_CMAKE_DESTINATION}/${_vtk_build_PACKAGE}-targets.cmake
") 2601 EXPORT "${_vtk_build_INSTALL_EXPORT}
" 2602 DESTINATION "${_vtk_build_CMAKE_DESTINATION}
" 2603 ${_vtk_build_namespace} 2604 FILE "${_vtk_build_PACKAGE}-targets.cmake
" 2605 COMPONENT "${_vtk_build_HEADERS_COMPONENT}
") 2607 if (_vtk_build_INSTALL_HEADERS) 2608 file(APPEND "${_vtk_build_properties_install_file}
" 2609 "unset(_vtk_module_import_prefix)\n
") 2612 FILES "${_vtk_build_properties_install_file}
" 2613 DESTINATION "${_vtk_build_CMAKE_DESTINATION}
" 2614 RENAME "${_vtk_build_properties_filename}
" 2615 COMPONENT "${_vtk_build_HEADERS_COMPONENT}
") 2619 get_property(_vtk_build_test_modules GLOBAL 2620 PROPERTY "_vtk_module_test_modules
") 2621 set(_vtk_build_tests_handled) 2622 foreach (_vtk_build_test IN LISTS _vtk_build_test_modules) 2623 if (NOT _vtk_build_test IN_LIST _vtk_build_MODULES) 2626 list(APPEND _vtk_build_tests_handled 2627 "${_vtk_build_test}
") 2629 get_property(_vtk_build_test_depends GLOBAL 2630 PROPERTY "_vtk_module_${_vtk_build_test}_test_depends
") 2632 set(_vtk_build_test_has_depends TRUE) 2633 foreach (_vtk_build_test_depend IN LISTS _vtk_build_test_depends) 2634 if (NOT TARGET "${_vtk_build_test_depend}
") 2635 set(_vtk_build_test_has_depends FALSE) 2636 _vtk_module_debug(testing "@_vtk_build_test@ testing disabled due to missing @_vtk_build_test_depend
@") 2639 if (NOT _vtk_build_test_has_depends) 2643 get_property(_vtk_build_module_file GLOBAL 2644 PROPERTY "_vtk_module_${_vtk_build_test}_file
") 2646 if (NOT _vtk_build_TEST_DIRECTORY_NAME STREQUAL "NONE
") 2647 get_filename_component(_vtk_build_module_dir "${_vtk_build_module_file}
" DIRECTORY) 2648 file(RELATIVE_PATH _vtk_build_module_subdir "${CMAKE_SOURCE_DIR}
" "${_vtk_build_module_dir}
") 2649 if (EXISTS "${CMAKE_SOURCE_DIR}/${_vtk_build_module_subdir}/${_vtk_build_TEST_DIRECTORY_NAME}
") 2650 get_property(_vtk_build_test_labels GLOBAL 2651 PROPERTY "_vtk_module_${_vtk_build_test}_test_labels
") 2653 "${CMAKE_SOURCE_DIR}/${_vtk_build_module_subdir}/${_vtk_build_TEST_DIRECTORY_NAME}
" 2654 "${CMAKE_BINARY_DIR}/${_vtk_build_module_subdir}/${_vtk_build_TEST_DIRECTORY_NAME}
") 2659 if (_vtk_build_test_modules AND _vtk_build_tests_handled) 2660 list(REMOVE_ITEM _vtk_build_test_modules 2661 ${_vtk_build_tests_handled}) 2664 _vtk_module_test_modules "${_vtk_build_test_modules}
") 2669 @ingroup module-impl 2670 @brief Add "standard
" include directories to a module 2672 Add the "standard
" includes for a module to its interface. These are the source 2673 and build directories for the module itself. They are always either `PUBLIC` or 2674 `INTERFACE` (depending on the module's target type). 2677 _vtk_module_standard_includes( 2681 [HEADERS_DESTINATION <destination>]) 2684 function (_vtk_module_standard_includes) 2685 cmake_parse_arguments(_vtk_standard_includes 2687 "TARGET;HEADERS_DESTINATION
" 2691 if (NOT _vtk_standard_includes_TARGET) 2693 "The `TARGET` argument is required.
") 2695 if (NOT TARGET "${_vtk_standard_includes_TARGET}
") 2697 "The `TARGET` argument is not a
target.
") 2700 if (_vtk_standard_includes_UNPARSED_ARGUMENTS) 2702 "Unparsed arguments
for vtk_module_standard_includes:
" 2703 "${_vtk_standard_includes_UNPARSED_ARGUMENTS}
") 2706 set(_vtk_standard_includes_system) 2707 if (_vtk_standard_includes_SYSTEM) 2708 set(_vtk_standard_includes_system SYSTEM) 2711 set(_vtk_standard_includes_visibility PUBLIC) 2712 if (_vtk_standard_includes_INTERFACE) 2713 set(_vtk_standard_includes_visibility INTERFACE) 2716 target_include_directories("${_vtk_standard_includes_TARGET}
" 2717 ${_vtk_standard_includes_system} 2718 "${_vtk_standard_includes_visibility}
" 2719 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> 2720 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>) 2722 if (_vtk_build_INSTALL_HEADERS AND _vtk_standard_includes_HEADERS_DESTINATION) 2723 target_include_directories("${_vtk_standard_includes_TARGET}
" 2724 ${_vtk_standard_includes_system} 2725 "${_vtk_standard_includes_visibility}
" 2726 $<INSTALL_INTERFACE:${_vtk_standard_includes_HEADERS_DESTINATION}>) 2731 @ingroup module-impl 2732 @brief Determine the default export macro for a module 2734 Determines the export macro to be used for a module from its metadata. Assumes 2735 it is called from within a @ref vtk_module_build call. 2738 _vtk_module_default_library_name(<varname>) 2741 function (_vtk_module_default_export_macro_prefix varname) 2742 get_property(_vtk_module_default_library_name GLOBAL 2743 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
") 2744 string(TOUPPER "${_vtk_module_default_library_name}
" _vtk_default_export_macro_upper) 2746 "${_vtk_default_export_macro_upper}
" 2750 # TODO: It would be nice to support `USE_LINK_PROPERTIES` instead of listing 2751 # the modules again here. However, the format of the `LINK_LIBRARIES` property 2752 # value may not be easy to handle. 2755 @page module-overview 2758 @section module-autoinit Autoinit 2760 When a module contains a factory which may be populated by other modules, these 2761 factories need to be populated when the modules are loaded by the dynamic linker 2762 (for shared builds) or program load time (for static builds). To provide for 2763 this, the module system contains an autoinit "subsystem
". 2765 @subsection module-autoinit-leverage Leveraging the autoinit subsystem 2767 The subsystem provides the following hooks for use by projects: 2769 * In modules which `IMPLEMENTS` other modules, in the generated 2770 `<module>Module.h` header (which provides export symbols as well) will 2771 include the modules which are implemented. 2772 * In modules which are `IMPLEMENTABLE` or `IMPLEMENTS` another module, the 2773 generated `<module>Module.h` file will include the following block: 2776 #ifdef <module>_AUTOINIT_INCLUDE 2777 #include <module>_AUTOINIT_INCLUDE 2779 #ifdef <module>_AUTOINIT 2781 VTK_MODULE_AUTOINIT(<module>) 2785 The @ref vtk_module_autoinit function will generate an include file and provide 2786 its path via the `<module>_AUTOINIT_INCLUDE` define. once it has been included, 2787 if the `<module>_AUTOINIT` symbol is defined, a header is included which is 2788 intended to provide the `VTK_MODULE_AUTOINIT` macro. This macro is given the 2789 module name and should use `<module>_AUTOINIT` to fill in the factories in the 2790 module with those from the `IMPLEMENTS` modules listed in that symbol. 2792 The `<module>_AUTOINIT` symbol's value is: 2795 <count>(<module1>,<module2>,<module3>) 2798 where `<count>` is the number of modules in the parentheses and each module 2799 listed need to register something to `<module>`. 2801 If not provided via the `AUTOINIT_INCLUDE` argument to the 2802 @ref vtk_module_add_module function, the header to use is fetched from the 2803 `_vtk_module_autoinit_include` global property. This only needs to be managed 2804 in modules that `IMPLEMENTS` or are `IMPLEMENTABLE`. This should be provided by 2805 projects using the module system at its lowest level. Projects not implementing 2806 the `VTK_MODULE_AUTOINIT` macro should have its value provided by 2807 `find_package` dependencies in some way. 2812 @brief Linking to autoinit-using modules 2814 When linking to modules, in order for the autoinit system to work, modules need 2815 to declare their registration. In order to do this, defines may need to be 2816 provided to targets in order to trigger registration. These defines may be 2817 added to targets by using this function. 2820 vtk_module_autoinit( 2822 MODULES <module>...) 2825 After this call, the targets given to the `TARGETS` argument will gain the 2826 preprocessor definitions to trigger registrations properly. 2828 function (vtk_module_autoinit) 2829 cmake_parse_arguments(_vtk_autoinit 2835 if (_vtk_autoinit_UNRECOGNIZED_ARGUMENTS) 2838 "${_vtk_autoinit_UNRECOGNIZED_ARGUMENTS}.
") 2841 if (NOT _vtk_autoinit_TARGETS) 2843 "The `TARGETS` argument is required.
") 2846 if (NOT _vtk_autoinit_MODULES) 2847 message(AUTHOR_WARNING 2848 "No `MODULES` passed to `vtk_modules_autoinit`.
") 2851 set(_vtk_autoinit_module_stack 2852 ${_vtk_autoinit_MODULES}) 2854 set(_vtk_autoinit_needs_implements) 2855 set(_vtk_autoinit_seen) 2856 while (_vtk_autoinit_module_stack) 2857 list(GET _vtk_autoinit_module_stack 0 _vtk_autoinit_current_module) 2858 list(REMOVE_AT _vtk_autoinit_module_stack 0) 2859 if (_vtk_autoinit_current_module IN_LIST _vtk_autoinit_seen) 2862 list(APPEND _vtk_autoinit_seen 2863 "${_vtk_autoinit_current_module}
") 2865 _vtk_module_real_target(_vtk_autoinit_current_target "${_vtk_autoinit_current_module}
") 2866 get_property(_vtk_autoinit_implements 2867 TARGET "${_vtk_autoinit_current_target}
" 2868 PROPERTY "INTERFACE_vtk_module_implements
") 2870 list(APPEND _vtk_autoinit_needs_implements 2871 ${_vtk_autoinit_implements}) 2872 foreach (_vtk_autoinit_implement IN LISTS _vtk_autoinit_implements) 2873 _vtk_module_real_target(_vtk_autoinit_implements_target "${_vtk_autoinit_implement}
") 2874 get_property(_vtk_autoinit_implementable 2875 TARGET "${_vtk_autoinit_implements_target}
" 2876 PROPERTY "INTERFACE_vtk_module_implementable
") 2878 if (NOT _vtk_autoinit_implementable) 2880 "The `${_vtk_autoinit_current_module}` module says that it
" 2881 "implements the `${_vtk_autoinit_implement}` module, but it is not
" 2885 list(APPEND "_vtk_autoinit_implements_${_vtk_autoinit_implement}
" 2886 "${_vtk_autoinit_current_module}
") 2890 if (NOT _vtk_autoinit_needs_implements) 2893 list(REMOVE_DUPLICATES _vtk_autoinit_needs_implements) 2894 list(SORT _vtk_autoinit_needs_implements) 2896 set(_vtk_autoinit_hash_content) 2897 foreach (_vtk_autoinit_need_implements IN LISTS _vtk_autoinit_needs_implements) 2898 if (NOT _vtk_autoinit_implements_${_vtk_autoinit_need_implements}) 2901 list(SORT "_vtk_autoinit_implements_${_vtk_autoinit_need_implements}
") 2903 string(APPEND _vtk_autoinit_hash_content 2904 "${_vtk_autoinit_need_implements}: ${_vtk_autoinit_implements_${_vtk_autoinit_need_implements}}\n
") 2906 string(MD5 _vtk_autoinit_header_tag "${_vtk_autoinit_hash_content}
") 2907 set(_vtk_autoinit_header 2908 "${CMAKE_BINARY_DIR}/CMakeFiles/vtkModuleAutoInit_${_vtk_autoinit_header_tag}.h
") 2910 get_property(_vtk_autoinit_header_generated GLOBAL 2911 PROPERTY "_vtk_autoinit_generated_${_vtk_autoinit_header_tag}
") 2913 set(_vtk_autoinit_defines) 2914 set(_vtk_autoinit_header_content) 2915 foreach (_vtk_autoinit_need_implements IN LISTS _vtk_autoinit_needs_implements) 2916 if (NOT _vtk_autoinit_implements_${_vtk_autoinit_need_implements}) 2920 get_property(_vtk_autoinit_implements_library_name 2921 TARGET "${_vtk_autoinit_need_implements}
" 2922 PROPERTY "INTERFACE_vtk_module_library_name
") 2924 if (NOT _vtk_autoinit_header_generated) 2925 list(LENGTH "_vtk_autoinit_implements_${_vtk_autoinit_need_implements}
" 2926 _vtk_autoinit_length) 2927 set(_vtk_autoinit_args) 2928 foreach (_vtk_autoinit_arg IN LISTS "_vtk_autoinit_implements_${_vtk_autoinit_need_implements}
") 2929 get_property(_vtk_autoinit_arg_library_name 2930 TARGET "${_vtk_autoinit_arg}
" 2931 PROPERTY "INTERFACE_vtk_module_library_name
") 2932 list(APPEND _vtk_autoinit_args 2933 "${_vtk_autoinit_arg_library_name}
") 2935 string(REPLACE ";
" ",
" _vtk_autoinit_args "${_vtk_autoinit_args}
") 2936 string(APPEND _vtk_autoinit_header_content 2937 "#define ${_vtk_autoinit_implements_library_name}_AUTOINIT ${_vtk_autoinit_length}(${_vtk_autoinit_args})\n
") 2940 list(APPEND _vtk_autoinit_defines 2941 "${_vtk_autoinit_implements_library_name}_AUTOINIT_INCLUDE=\
"${_vtk_autoinit_header}\"")
2944 if (NOT _vtk_autoinit_header_generated)
2946 OUTPUT "${_vtk_autoinit_header}
" 2947 CONTENT "${_vtk_autoinit_header_content}
") 2951 "_vtk_autoinit_generated_${_vtk_autoinit_header_tag}
" TRUE) 2954 foreach (_vtk_autoinit_target IN LISTS _vtk_autoinit_TARGETS) 2955 get_property(_vtk_autoinit_target_type 2956 TARGET "${_vtk_autoinit_target}
" 2958 if (_vtk_autoinit_target_type STREQUAL "INTERFACE_LIBRARY
") 2962 target_compile_definitions("${_vtk_autoinit_target}
" 2964 ${_vtk_autoinit_defines}) 2969 @ingroup module-impl 2970 @brief Generate the hierarchy for a module 2972 Write wrap hierarchy files for the module currently being built. This also 2973 installs the hierarchy file for use by dependent projects if `INSTALL_HEADERS` 2977 _vtk_module_write_wrap_hierarchy() 2980 function (_vtk_module_write_wrap_hierarchy) 2981 file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/${_vtk_build_HIERARCHY_DESTINATION}
") 2983 get_property(_vtk_hierarchy_library_name GLOBAL 2984 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
") 2985 set(_vtk_hierarchy_filename "${_vtk_hierarchy_library_name}-hierarchy.txt
") 2986 set(_vtk_hierarchy_file "${CMAKE_BINARY_DIR}/${_vtk_build_HIERARCHY_DESTINATION}/${_vtk_hierarchy_filename}
") 2987 set(_vtk_hierarchy_args_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_hierarchy_library_name}-hierarchy.$<CONFIGURATION>.args
") 2988 set(_vtk_hierarchy_data_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_hierarchy_library_name}-hierarchy.data
") 2989 set(_vtk_hierarchy_depends_args_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_hierarchy_library_name}-hierarchy.depends.args
") 2991 set_property(TARGET "${_vtk_add_module_real_target}
" 2993 "INTERFACE_vtk_module_hierarchy
" "${_vtk_hierarchy_file}
") 2995 set(_vtk_add_module_target_name_iface "${_vtk_add_module_target_name}
") 2996 if (_vtk_add_module_build_with_kit) 2997 set(_vtk_add_module_target_name_iface "${_vtk_add_module_target_name}-objects
") 2999 set(_vtk_hierarchy_genex_compile_definitions 3000 "$<TARGET_PROPERTY:${_vtk_add_module_target_name_iface},COMPILE_DEFINITIONS>
") 3001 set(_vtk_hierarchy_genex_include_directories 3002 "$<TARGET_PROPERTY:${_vtk_add_module_target_name_iface},INCLUDE_DIRECTORIES>
") 3004 OUTPUT "${_vtk_hierarchy_args_file}
" 3005 CONTENT "$<$<BOOL:${_vtk_hierarchy_genex_compile_definitions}>:\n-D\
'$<JOIN:${_vtk_hierarchy_genex_compile_definitions},\'\n-D\'>\'>\n 3006 $<$<BOOL:${_vtk_hierarchy_genex_include_directories}>:\n-I\'$<JOIN:${_vtk_hierarchy_genex_include_directories},\'\n-I\'>\'>\n") 3008 get_property(_vtk_hierarchy_depends_is_global GLOBAL 3009 PROPERTY "_vtk_module_${_vtk_build_module}_depends" 3011 if (_vtk_hierarchy_depends_is_global) 3012 get_property(_vtk_hierarchy_depends GLOBAL 3013 PROPERTY "_vtk_module_${_vtk_build_module}_depends") 3015 get_property(_vtk_hierarchy_depends GLOBAL 3016 TARGET "${_vtk_add_module_real_target}" 3017 PROPERTY "INTERFACE_vtk_module_depends") 3020 set(_vtk_hierarchy_depends_files) 3021 set(_vtk_hierarchy_depends_targets) 3022 foreach (_vtk_hierarchy_depend IN LISTS _vtk_hierarchy_depends) 3023 _vtk_module_get_module_property("${_vtk_hierarchy_depend}" 3024 PROPERTY "hierarchy" 3025 VARIABLE _vtk_hierarchy_depend_hierarchy) 3026 if (NOT DEFINED _vtk_hierarchy_depend_hierarchy) 3030 list(APPEND _vtk_hierarchy_depends_files 3031 "${_vtk_hierarchy_depend_hierarchy}") 3033 # Find the hierarchy target of the module. 3034 get_property(_vtk_hierarchy_module_is_imported 3035 TARGET "${_vtk_hierarchy_depend}" 3037 # Imported target modules are external and should already have their file 3039 if (_vtk_hierarchy_module_is_imported) 3043 get_property(_vtk_hierarchy_depend_library_name GLOBAL 3044 PROPERTY "_vtk_module_${_vtk_hierarchy_depend}_library_name") 3045 if (TARGET "${_vtk_hierarchy_depend_library_name}-hierarchy") 3046 list(APPEND _vtk_hierarchy_depends_targets 3047 "${_vtk_hierarchy_depend_library_name}-hierarchy") 3051 set(_vtk_hierarchy_depends_files_arg) 3052 if (_vtk_hierarchy_depends_files) 3054 OUTPUT "${_vtk_hierarchy_depends_args_file}" 3055 CONTENT "\"$<JOIN:${_vtk_hierarchy_depends_files},\"\n\">\"\n") 3058 OUTPUT "${_vtk_hierarchy_depends_args_file}" 3062 _vtk_module_get_module_property("${_vtk_build_module}" 3064 VARIABLE _vtk_hierarchy_headers) 3065 set(_vtk_hierarchy_data_content "") 3066 foreach (_vtk_hierarchy_header IN LISTS _vtk_hierarchy_headers) 3067 string(APPEND _vtk_hierarchy_data_content 3068 "${_vtk_hierarchy_header};${_vtk_hierarchy_library_name}\n") 3071 OUTPUT "${_vtk_hierarchy_data_file}" 3072 CONTENT "${_vtk_hierarchy_data_content}") 3074 if (CMAKE_GENERATOR MATCHES "Ninja") 3075 set(_vtk_hierarchy_command_depends ${_vtk_hierarchy_depends_files}) 3077 set(_vtk_hierarchy_command_depends ${_vtk_hierarchy_depends_targets}) 3080 set(_vtk_hierarchy_tool_target "VTK::WrapHierarchy") 3081 set(_vtk_hierarchy_macros_args) 3082 if (TARGET VTKCompileTools::WrapHierarchy) 3083 set(_vtk_hierarchy_tool_target "VTKCompileTools::WrapHierarchy") 3084 if (TARGET VTKCompileTools_macros) 3085 list(APPEND _vtk_hierarchy_command_depends 3086 "VTKCompileTools_macros") 3087 list(APPEND _vtk_hierarchy_macros_args 3089 -imacros "${_VTKCompileTools_macros_file}") 3094 OUTPUT "${_vtk_hierarchy_file}" 3095 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} 3096 "$<TARGET_FILE:${_vtk_hierarchy_tool_target}>" 3097 "@${_vtk_hierarchy_args_file}" 3098 -o "${_vtk_hierarchy_file}" 3099 "${_vtk_hierarchy_data_file}" 3100 "@${_vtk_hierarchy_depends_args_file}" 3101 ${_vtk_hierarchy_macros_args} 3102 COMMENT "Generating the wrap hierarchy for ${_vtk_build_module}" 3104 ${_vtk_hierarchy_headers} 3105 "${_vtk_hierarchy_args_file}" 3106 "${_vtk_hierarchy_data_file}" 3107 "${_vtk_hierarchy_depends_args_file}" 3108 ${_vtk_hierarchy_command_depends}) 3109 add_custom_target("${_vtk_add_module_library_name}-hierarchy" ALL 3111 "${_vtk_hierarchy_file}" 3112 "$<TARGET_FILE:${_vtk_hierarchy_tool_target}>") 3113 set_property(TARGET "${_vtk_add_module_real_target}" 3115 "INTERFACE_vtk_module_hierarchy" "${_vtk_hierarchy_file}") 3117 if (_vtk_build_INSTALL_HEADERS) 3118 set_property(TARGET "${_vtk_add_module_real_target}" 3120 "INTERFACE_vtk_module_hierarchy_install" "\${_vtk_module_import_prefix}/${_vtk_build_HIERARCHY_DESTINATION}/${_vtk_hierarchy_filename}") 3122 FILES "${_vtk_hierarchy_file}" 3123 DESTINATION "${_vtk_build_HIERARCHY_DESTINATION}" 3124 RENAME "${_vtk_hierarchy_filename}" 3125 COMPONENT "${_vtk_build_HEADERS_COMPONENT}") 3129 include(GenerateExportHeader) 3133 @brief Create a module library 3136 vtk_module_add_module(<name> 3137 [FORCE_STATIC] [HEADER_ONLY] 3138 [EXPORT_MACRO_PREFIX <prefix>] 3139 [HEADERS_SUBDIR <subdir>] 3140 [LIBRARY_NAME_SUFFIX <suffix>] 3141 [CLASSES <class>...] 3142 [TEMPLATE_CLASSES <template class>...] 3143 [SOURCES <source>...] 3144 [HEADERS <header>...] 3145 [TEMPLATES <template>...] 3146 [PRIVATE_CLASSES <class>...] 3147 [PRIVATE_TEMPLATE_CLASSES <template class>...] 3148 [PRIVATE_HEADERS <header>...] 3149 [PRIVATE_TEMPLATES <template>...]) 3152 The `PRIVATE_` arguments are analogous to their non-`PRIVATE_` arguments, but 3153 the associated files are not installed or available for wrapping (`SOURCES` are 3154 always private, so there is no `PRIVATE_` variant for that argument). 3156 * `FORCE_STATIC`: For a static library to be created. If not provided, 3157 `BUILD_SHARED_LIBS` will control the library type. 3158 * `HEADER_ONLY`: The module only contains headers (or templates) and contains 3159 no compilation steps. Mutually exclusive with `FORCE_STATIC`. 3160 * `EXPORT_MACRO_PREFIX`: The prefix for the export macro definitions. 3161 Defaults to the library name of the module in all uppercase. 3162 * `HEADERS_SUBDIR`: The subdirectory to install headers into in the install 3164 * `LIBRARY_NAME_SUFFIX`: The suffix to the module's library
name if 3165 additional information is required.
3166 * `CLASSES`: A list of classes in the module. This is a shortcut
for adding
3167 `<
class>.cxx` to `SOURCES` and `<
class>.h` to `HEADERS`.
3168 * `TEMPLATE_CLASSES`: A list of
template classes in the module. This is a
3169 shortcut
for adding `<
class>.txx` to `TEMPLATES` and `<
class>.h` to
3171 * `SOURCES`: A list of
source files which require compilation.
3172 * `HEADERS`: A list of header files which will be available
for wrapping and
3174 * `TEMPLATES`: A list of
template files which will be installed.
3177 if (NOT
name STREQUAL _vtk_build_module)
3179 "The ${_vtk_build_module}'s CMakeLists.txt may not add the ${name} module.")
3182 set(_vtk_add_module_source_keywords)
3183 foreach (_vtk_add_module_kind IN ITEMS CLASSES TEMPLATE_CLASSES HEADERS TEMPLATES)
3184 list(APPEND _vtk_add_module_source_keywords
3185 "${_vtk_add_module_kind}
" 3186 "PRIVATE_${_vtk_add_module_kind}
") 3189 cmake_parse_arguments(_vtk_add_module 3190 "FORCE_STATIC;HEADER_ONLY
" 3191 "EXPORT_MACRO_PREFIX;HEADERS_SUBDIR;LIBRARY_NAME_SUFFIX
" 3192 "${_vtk_add_module_source_keywords};SOURCES
" 3195 if (_vtk_add_module_UNPARSED_ARGUMENTS) 3198 "${_vtk_add_module_UNPARSED_ARGUMENTS}
") 3201 if (NOT DEFINED _vtk_add_module_EXPORT_MACRO_PREFIX) 3202 _vtk_module_default_export_macro_prefix(_vtk_add_module_EXPORT_MACRO_PREFIX) 3205 if (_vtk_add_module_HEADER_ONLY AND _vtk_add_module_FORCE_STATIC) 3207 "The ${_vtk_build_module} module cannot be header only yet forced
" 3211 foreach (_vtk_add_module_class IN LISTS _vtk_add_module_CLASSES) 3212 list(APPEND _vtk_add_module_SOURCES 3213 "${_vtk_add_module_class}.cxx
") 3214 list(APPEND _vtk_add_module_HEADERS 3215 "${_vtk_add_module_class}.h
") 3218 foreach (_vtk_add_module_template_class IN LISTS _vtk_add_module_TEMPLATE_CLASSES) 3219 list(APPEND _vtk_add_module_TEMPLATES 3220 "${_vtk_add_module_template_class}.txx
") 3221 list(APPEND _vtk_add_module_HEADERS 3222 "${_vtk_add_module_template_class}.h
") 3225 foreach (_vtk_add_module_class IN LISTS _vtk_add_module_PRIVATE_CLASSES) 3226 list(APPEND _vtk_add_module_SOURCES 3227 "${_vtk_add_module_class}.cxx
") 3228 list(APPEND _vtk_add_module_PRIVATE_HEADERS 3229 "${_vtk_add_module_class}.h
") 3232 foreach (_vtk_add_module_template_class IN LISTS _vtk_add_module_PRIVATE_TEMPLATE_CLASSES) 3233 list(APPEND _vtk_add_module_PRIVATE_TEMPLATES 3234 "${_vtk_add_module_template_class}.txx
") 3235 list(APPEND _vtk_add_module_PRIVATE_HEADERS 3236 "${_vtk_add_module_template_class}.h
") 3239 if (NOT _vtk_add_module_SOURCES AND NOT _vtk_add_module_HEADER_ONLY) 3241 "The ${_vtk_build_module} module has no
source files.
") 3244 get_property(_vtk_add_module_third_party GLOBAL 3245 PROPERTY "_vtk_module_${_vtk_build_module}_third_party
") 3247 get_property(_vtk_add_module_library_name GLOBAL 3248 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
") 3249 set(_vtk_add_module_module_header_name 3250 "${_vtk_add_module_library_name}Module.h
") 3251 if (NOT _vtk_add_module_HEADER_ONLY AND NOT _vtk_add_module_third_party) 3252 set(_vtk_add_module_generated_header 3253 "${CMAKE_CURRENT_BINARY_DIR}/${_vtk_add_module_module_header_name}
") 3254 list(APPEND _vtk_add_module_HEADERS 3255 "${_vtk_add_module_generated_header}
") 3258 vtk_module_install_headers( 3259 FILES ${_vtk_add_module_HEADERS} 3260 ${_vtk_add_module_TEMPLATES} 3261 SUBDIR "${_vtk_add_module_HEADERS_SUBDIR}
") 3263 set(_vtk_add_module_type) 3264 if (_vtk_add_module_FORCE_STATIC) 3265 set(_vtk_add_module_type STATIC) 3268 set(_vtk_add_module_build_with_kit) 3269 if (_vtk_build_BUILD_WITH_KITS) 3270 get_property(_vtk_add_module_build_with_kit GLOBAL 3271 PROPERTY "_vtk_module_${_vtk_build_module}_kit
") 3274 get_property(_vtk_add_module_namespace GLOBAL 3275 PROPERTY "_vtk_module_${_vtk_build_module}_namespace
") 3276 get_property(_vtk_add_module_target_name GLOBAL 3277 PROPERTY "_vtk_module_${_vtk_build_module}_target_name
") 3278 set(_vtk_add_module_real_target "${_vtk_add_module_target_name}
") 3279 if (_vtk_add_module_HEADER_ONLY) 3280 if (_vtk_add_module_build_with_kit) 3282 "The module ${_vtk_build_module} is header-only, but is part of the
" 3283 "${_vtk_add_module_build_with_kit} kit. Header-only modules
do not
" 3287 # XXX(cmake-3.12.0): This unset is no longer necessary when 3.12.0 is required. 3288 unset("${_vtk_build_module}_LIB_DEPENDS
" CACHE) 3289 add_library("${_vtk_add_module_real_target}
" INTERFACE) 3291 if (NOT _vtk_build_module STREQUAL _vtk_add_module_real_target) 3292 add_library("${_vtk_build_module}
" ALIAS 3293 "${_vtk_add_module_real_target}
") 3296 if (_vtk_add_module_build_with_kit) 3297 add_library("${_vtk_add_module_real_target}
" INTERFACE) 3298 target_link_libraries("${_vtk_add_module_real_target}
" 3300 # For usage requirements. 3301 "${_vtk_add_module_real_target}-objects
" 3302 # For the implementation. 3303 "$<LINK_ONLY:${_vtk_add_module_build_with_kit}>
") 3305 if (NOT _vtk_build_module STREQUAL _vtk_add_module_real_target) 3306 add_library("${_vtk_build_module}
" ALIAS 3307 "${_vtk_add_module_real_target}
") 3310 # Set up properties necessary for other infrastructure. 3311 set_property(TARGET "${_vtk_add_module_real_target}
" 3313 "INTERFACE_vtk_module_library_name
" "${_vtk_add_module_library_name}
") 3315 # XXX(cmake-3.12.0): This unset is no longer necessary when 3.12.0 is required. 3316 unset("${_vtk_build_module}_LIB_DEPENDS
" CACHE) 3317 add_library("${_vtk_add_module_real_target}-objects
" OBJECT 3318 ${_vtk_add_module_SOURCES} 3319 ${_vtk_add_module_TEMPLATES} 3320 ${_vtk_add_module_PRIVATE_TEMPLATES} 3321 ${_vtk_add_module_HEADERS} 3322 ${_vtk_add_module_PRIVATE_HEADERS}) 3323 set_target_properties("${_vtk_add_module_real_target}-objects
" 3325 # Emulate the regular library as much as possible. 3326 DEFINE_SYMBOL "${_vtk_add_module_real_target}_EXPORT
" 3327 POSITION_INDEPENDENT_CODE ON) 3328 target_compile_definitions("${_vtk_add_module_real_target}-objects
" 3330 "${_vtk_add_module_real_target}_EXPORT
") 3331 set(_vtk_add_module_real_target "${_vtk_add_module_real_target}-objects
") 3333 add_library("${_vtk_add_module_real_target}
" ${_vtk_add_module_type} 3334 ${_vtk_add_module_SOURCES} 3335 ${_vtk_add_module_TEMPLATES} 3336 ${_vtk_add_module_HEADERS} 3337 ${_vtk_add_module_PRIVATE_HEADERS}) 3339 set_property(TARGET "${_vtk_add_module_real_target}
" 3341 POSITION_INDEPENDENT_CODE ON) 3343 if (NOT _vtk_build_module STREQUAL _vtk_add_module_real_target) 3344 add_library("${_vtk_build_module}
" ALIAS 3345 "${_vtk_add_module_real_target}
") 3350 set_property(TARGET "${_vtk_add_module_real_target}
" 3352 "INTERFACE_vtk_module_library_name
" "${_vtk_add_module_library_name}
") 3354 get_property(_vtk_add_module_depends GLOBAL 3355 PROPERTY "_vtk_module_${_vtk_build_module}_depends
") 3356 set_property(TARGET "${_vtk_add_module_real_target}
" 3358 "INTERFACE_vtk_module_depends
" "${_vtk_add_module_depends}
") 3359 set(_vtk_add_module_includes_interface) 3360 if (_vtk_add_module_HEADER_ONLY) 3361 target_link_libraries("${_vtk_add_module_real_target}
" 3363 ${_vtk_add_module_depends}) 3364 set(_vtk_add_module_includes_interface INTERFACE) 3366 get_property(_vtk_add_module_private_depends GLOBAL 3367 PROPERTY "_vtk_module_${_vtk_build_module}_private_depends
") 3369 # XXX(cmake#18484): Linking dependencies directly currently creates 3370 # circular dependencies. This logic should be removed once the minimum for 3371 # kits contains a fix for the mentioned issue. 3373 # When two modules are part of the same kit, we can get this problem: 3375 # A - iface -> A-objects <- tll - K 3378 # B - iface -> B-objects <- tll -/ 3380 # If B depends on A, it ends up with a circular dependency since A has a 3381 # `$<LINK_ONLY:K>` link. instead, munge up dependencies of intra-kit 3382 # dependencies to link to the `-objects` target instead. 3383 if (_vtk_add_module_build_with_kit) 3384 set(_vtk_add_module_depends_link) 3385 set(_vtk_add_module_private_depends_link) 3386 foreach (_vtk_add_module_depend IN LISTS _vtk_add_module_depends) 3387 get_property(_vtk_add_module_depend_kit GLOBAL 3388 PROPERTY "_vtk_module_${_vtk_add_module_depend}_kit
") 3389 if (_vtk_add_module_depend_kit STREQUAL _vtk_add_module_build_with_kit) 3390 # We're in the same kit; depend on the `-objects` library of the 3392 get_property(_vtk_add_module_depend_target_name GLOBAL 3393 PROPERTY "_vtk_module_${_vtk_add_module_depend}_target_name
") 3394 list(APPEND _vtk_add_module_depends_link 3395 "${_vtk_add_module_depend_target_name}-objects
") 3397 # Different kit, just use as normal. 3398 list(APPEND _vtk_add_module_depends_link 3399 "${_vtk_add_module_depend}
") 3402 foreach (_vtk_add_module_private_depend IN LISTS _vtk_add_module_private_depends) 3403 get_property(_vtk_add_module_private_depend_kit GLOBAL 3404 PROPERTY "_vtk_module_${_vtk_add_module_private_depend}_kit
") 3405 if (_vtk_add_module_private_depend_kit STREQUAL _vtk_add_module_build_with_kit) 3406 # We're in the same kit; depend on the `-objects` library of the 3408 get_property(_vtk_add_module_private_depend_target_name GLOBAL 3409 PROPERTY "_vtk_module_${_vtk_add_module_private_depend}_target_name
") 3410 list(APPEND _vtk_add_module_private_depends_link 3411 "${_vtk_add_module_private_depend_target_name}-objects
") 3413 # Different kit, just use as normal. 3414 list(APPEND _vtk_add_module_private_depends_link 3415 "${_vtk_add_module_private_depend}
") 3419 # Add the `DEFINE_SYMBOL` for all other modules within the same kit which 3420 # have already been processed because the direct dependencies are not 3421 # sufficient: export symbols from any included header needs to be 3422 # correct. Since modules are built in topological order, a module can 3423 # only possibly include modules in the kit which have already been built. 3424 get_property(_vtk_add_module_kit_modules GLOBAL 3425 PROPERTY "_vtk_kit_${_vtk_add_module_build_with_kit}_kit_modules
") 3426 list(REMOVE_ITEM _vtk_add_module_kit_modules "${_vtk_build_module}
") 3427 foreach (_vtk_add_module_kit_module IN LISTS _vtk_add_module_kit_modules) 3428 get_property(_vtk_add_module_kit_module_target_name GLOBAL 3429 PROPERTY "_vtk_module_${_vtk_add_module_kit_module}_target_name
") 3430 if (TARGET "${_vtk_add_module_kit_module_target_name}-objects
") 3431 get_property(_vtk_add_module_kit_module_define_symbol 3432 TARGET "${_vtk_add_module_kit_module_target_name}-objects
" 3433 PROPERTY DEFINE_SYMBOL) 3434 target_compile_definitions("${_vtk_add_module_real_target}
" 3436 "${_vtk_add_module_kit_module_define_symbol}
") 3440 set(_vtk_add_module_depends_link ${_vtk_add_module_depends}) 3441 set(_vtk_add_module_private_depends_link ${_vtk_add_module_private_depends}) 3443 target_link_libraries("${_vtk_add_module_real_target}
" 3445 ${_vtk_add_module_depends_link} 3447 ${_vtk_add_module_private_depends_link}) 3449 set(_vtk_add_module_private_depends_forward_link) 3450 foreach (_vtk_add_module_private_depend IN LISTS _vtk_add_module_depends_link _vtk_add_module_private_depends) 3451 _vtk_module_get_module_property("${_vtk_add_module_private_depend}
" 3452 PROPERTY "forward_link
" 3453 VARIABLE _vtk_add_module_forward_link) 3454 list(APPEND _vtk_add_module_private_depends_forward_link 3455 ${_vtk_add_module_forward_link}) 3458 get_property(_vtk_add_module_optional_depends GLOBAL 3459 PROPERTY "_vtk_module_${_vtk_build_module}_optional_depends
") 3460 foreach (_vtk_add_module_optional_depend IN LISTS _vtk_add_module_optional_depends) 3461 if (TARGET "${_vtk_add_module_optional_depend}
") 3462 set(_vtk_add_module_have_optional_depend 1) 3463 set(_vtk_add_module_optional_depend_link "${_vtk_add_module_optional_depend}
") 3464 if (_vtk_add_module_build_with_kit) 3465 get_property(_vtk_add_module_optional_depend_kit GLOBAL 3466 PROPERTY "_vtk_module_${_vtk_add_module_optional_depend}_kit
") 3467 if (_vtk_add_module_optional_depend_kit STREQUAL _vtk_add_module_build_with_kit) 3468 # We're in the same kit; depend on the `-objects` library of the 3469 # module to avoid circular dependency (see explanation earlier) 3470 get_property(_vtk_add_module_optional_depend_target_name GLOBAL 3471 PROPERTY "_vtk_module_${_vtk_add_module_optional_depend}_target_name
") 3472 set(_vtk_add_module_optional_depend_link "${_vtk_add_module_optional_depend_target_name}-objects
") 3475 _vtk_module_get_module_property("${_vtk_add_module_optional_depend_link}
" 3476 PROPERTY "forward_link
" 3477 VARIABLE _vtk_add_module_forward_link) 3478 list(APPEND _vtk_add_module_private_depends_forward_link 3479 ${_vtk_add_module_forward_link}) 3480 target_link_libraries("${_vtk_add_module_real_target}
" 3482 "${_vtk_add_module_optional_depend_link}
") 3484 set(_vtk_add_module_have_optional_depend 0) 3486 string(REPLACE "::
" "_
" _vtk_add_module_optional_depend_safe "${_vtk_add_module_optional_depend}
") 3487 target_compile_definitions("${_vtk_add_module_real_target}
" 3489 "VTK_MODULE_ENABLE_${_vtk_add_module_optional_depend_safe}=${_vtk_add_module_have_optional_depend}
") 3492 if (_vtk_add_module_private_depends_forward_link) 3493 list(REMOVE_DUPLICATES _vtk_add_module_private_depends_forward_link) 3494 _vtk_module_set_module_property("${_vtk_build_module}
" APPEND 3495 PROPERTY "forward_link
" 3496 VALUE "${_vtk_add_module_private_depends_forward_link}
") 3497 target_link_libraries("${_vtk_add_module_real_target}
" 3499 "${_vtk_add_module_private_depends_forward_link}
") 3502 _vtk_module_standard_includes( 3503 TARGET "${_vtk_add_module_real_target}
" 3504 ${_vtk_add_module_includes_interface} 3505 HEADERS_DESTINATION "${_vtk_build_HEADERS_DESTINATION}
") 3507 vtk_module_autoinit( 3508 MODULES ${_vtk_add_module_depends} 3509 ${_vtk_add_module_private_depends} 3510 "${_vtk_build_module}
" 3511 TARGETS "${_vtk_add_module_real_target}
") 3513 set(_vtk_add_module_headers_build) 3514 set(_vtk_add_module_headers_install) 3515 # TODO: Perform this in `vtk_module_install_headers` so that manually 3516 # installed headers may participate in wrapping as well. 3517 foreach (_vtk_add_module_header IN LISTS _vtk_add_module_HEADERS) 3518 if (IS_ABSOLUTE "${_vtk_add_module_header}
") 3519 list(APPEND _vtk_add_module_headers_build 3520 "${_vtk_add_module_header}
") 3522 list(APPEND _vtk_add_module_headers_build 3523 "${CMAKE_CURRENT_SOURCE_DIR}/${_vtk_add_module_header}
") 3526 get_filename_component(_vtk_add_module_header_name "${_vtk_add_module_header}
" NAME) 3527 list(APPEND _vtk_add_module_headers_install 3528 "\${_vtk_module_import_prefix}/${_vtk_build_HEADERS_DESTINATION}/${_vtk_add_module_header_name}
") 3531 set_property(TARGET "${_vtk_add_module_real_target}
" 3533 "INTERFACE_vtk_module_headers
" "${_vtk_add_module_headers_build}
") 3534 if (_vtk_build_INSTALL_HEADERS) 3535 set_property(TARGET "${_vtk_add_module_real_target}
" 3537 "INTERFACE_vtk_module_headers_install
" "${_vtk_add_module_headers_install}
") 3540 get_property(_vtk_add_module_exclude_wrap GLOBAL 3541 PROPERTY "_vtk_module_${_vtk_build_module}_exclude_wrap
") 3542 set_property(TARGET "${_vtk_add_module_real_target}
" 3544 "INTERFACE_vtk_module_exclude_wrap
" "${_vtk_add_module_exclude_wrap}
") 3545 if (NOT _vtk_add_module_exclude_wrap AND _vtk_build_ENABLE_WRAPPING) 3546 _vtk_module_write_wrap_hierarchy() 3549 set(_vtk_add_module_module_content) 3551 if (NOT _vtk_add_module_AUTOINIT_INCLUDE) 3552 get_property(_vtk_add_module_AUTOINIT_INCLUDE GLOBAL 3553 PROPERTY "_vtk_module_autoinit_include
") 3556 set(_vtk_add_module_autoinit_include_header) 3557 if (_vtk_add_module_AUTOINIT_INCLUDE) 3558 set(_vtk_add_module_autoinit_include_header 3559 "#include ${_vtk_add_module_AUTOINIT_INCLUDE}
") 3562 set(_vtk_add_module_autoinit_depends_includes) 3563 foreach (_vtk_add_module_autoinit_dependency IN LISTS _vtk_add_module_depends) 3564 get_property(_vtk_add_module_autoinit_dependency_target_name GLOBAL 3565 PROPERTY "_vtk_module_${_vtk_add_module_autoinit_dependency}_target_name
") 3566 if (_vtk_add_module_autoinit_dependency_target_name) 3567 get_property(_vtk_add_module_depends_needs_autoinit 3568 TARGET "${_vtk_add_module_autoinit_dependency_target_name}
" 3569 PROPERTY "INTERFACE_vtk_module_needs_autoinit
") 3571 set(_vtk_add_module_autoinit_dependency_target_name 3572 "${_vtk_add_module_autoinit_dependency}
") 3573 get_property(_vtk_add_module_depends_needs_autoinit 3574 TARGET "${_vtk_add_module_autoinit_dependency}
" 3575 PROPERTY "INTERFACE_vtk_module_needs_autoinit
") 3577 if (NOT _vtk_add_module_depends_needs_autoinit) 3580 get_property(_vtk_add_module_depends_library_name 3581 TARGET "${_vtk_add_module_autoinit_dependency_target_name}
" 3582 PROPERTY "INTERFACE_vtk_module_library_name
") 3584 string(APPEND _vtk_add_module_autoinit_depends_includes 3585 "#include \
"${_vtk_add_module_depends_library_name}Module.h\"\n")
3588 set(_vtk_add_module_autoinit_content)
3589 if (_vtk_add_module_autoinit_depends_includes)
3590 set(_vtk_add_module_autoinit_content
3591 "${_vtk_add_module_autoinit_content}\n${_vtk_add_module_autoinit_depends_includes}\n
") 3594 get_property(_vtk_add_module_implementable GLOBAL 3595 PROPERTY "_vtk_module_${_vtk_build_module}_implementable
") 3596 get_property(_vtk_add_module_implements GLOBAL 3597 PROPERTY "_vtk_module_${_vtk_build_module}_implements
") 3598 if (_vtk_add_module_implementable) 3599 set_property(TARGET "${_vtk_add_module_real_target}
" 3601 "INTERFACE_vtk_module_implementable
" 1) 3604 if (_vtk_add_module_implementable OR _vtk_add_module_implements) 3605 set_property(TARGET "${_vtk_add_module_real_target}
" 3607 "INTERFACE_vtk_module_implements
" "${_vtk_add_module_implements}
") 3608 set_property(TARGET "${_vtk_add_module_real_target}
" 3610 "INTERFACE_vtk_module_needs_autoinit
" 1) 3612 set(_vtk_add_module_autoinit_content 3613 "${_vtk_add_module_autoinit_content}
3615 #ifdef ${_vtk_add_module_library_name}_AUTOINIT_INCLUDE 3616 #include ${_vtk_add_module_library_name}_AUTOINIT_INCLUDE 3618 #ifdef ${_vtk_add_module_library_name}_AUTOINIT 3619 ${_vtk_add_module_autoinit_include_header}
3624 set(_vtk_add_module_module_content 3625 "${_vtk_add_module_module_content}${_vtk_add_module_autoinit_content}
") 3628 if (NOT _vtk_add_module_HEADER_ONLY AND NOT _vtk_add_module_third_party) 3629 generate_export_header("${_vtk_add_module_real_target}
" 3630 EXPORT_MACRO_NAME "${_vtk_add_module_EXPORT_MACRO_PREFIX}_EXPORT
" 3631 NO_EXPORT_MACRO_NAME "${_vtk_add_module_EXPORT_MACRO_PREFIX}_NO_EXPORT
" 3632 DEPRECATED_MACRO_NAME "${_vtk_add_module_EXPORT_MACRO_PREFIX}_DEPRECATED
" 3633 NO_DEPRECATED_MACRO_NAME "${_vtk_add_module_EXPORT_MACRO_PREFIX}_NO_DEPRECATED
" 3634 STATIC_DEFINE "${_vtk_add_module_EXPORT_MACRO_PREFIX}_STATIC_DEFINE
" 3635 EXPORT_FILE_NAME "${_vtk_add_module_module_header_name}
" 3636 CUSTOM_CONTENT_FROM_VARIABLE _vtk_add_module_module_content) 3639 _vtk_module_apply_properties("${_vtk_add_module_target_name}
") 3640 _vtk_module_install("${_vtk_add_module_target_name}
") 3641 _vtk_module_add_header_tests() 3643 if (_vtk_add_module_build_with_kit) 3644 _vtk_module_install("${_vtk_add_module_target_name}-objects
") 3649 @ingroup module-impl 3650 @brief Add header tests for a module 3652 @todo Move this function out to be VTK-specific, probably into 3653 `vtkModuleTesting.cmake`. Each module would then need to manually call this 3654 function. It currently assumes it is in VTK itself. 3657 _vtk_module_add_header_tests() 3660 function (_vtk_module_add_header_tests) 3661 if (NOT BUILD_TESTING) 3665 get_property(_vtk_add_header_tests_is_third_party GLOBAL 3666 PROPERTY "_vtk_module_${_vtk_build_module}_third_party
") 3667 if (_vtk_add_header_tests_is_third_party) 3671 # TODO: Add test compiles which include each header file to ensure that 3672 # public headers have their includes satisfied by a public dependency. 3675 if (NOT "Python${VTK_PYTHON_VERSION}_EXECUTABLE
") 3680 if (NOT VTK_SOURCE_DIR) 3685 NAME "${_vtk_build_module}-HeaderTest
" 3686 COMMAND "${Python${VTK_PYTHON_VERSION}_EXECUTABLE}
" 3687 # TODO: What to do when using this from a VTK install? 3688 "${VTK_SOURCE_DIR}/Testing/Core/HeaderTesting.py
" 3689 "${CMAKE_CURRENT_SOURCE_DIR}
" 3690 "${_vtk_add_module_EXPORT_MACRO}
") 3695 @brief Install headers 3697 Installing headers is done for normal modules by the @ref vtk_module_add_module 3698 function already. However, sometimes header structures are more complicated and 3699 need to be installed manually. This is common for third party modules or 3700 projects which use more than a single directory of headers for a module. 3702 To facilitate the installation of headers in various ways, the this function is 3703 available. This function honors the `INSTALL_HEADERS`, `HEADERS_DESTINATION`, 3704 and `HEADERS_COMPONENT` arguments to @ref vtk_module_build. 3707 vtk_module_install_headers( 3708 [DIRECTORIES <directory>...] 3713 Installation of header directories follows CMake's `install` function semantics 3714 with respect to trailing slashes. 3716 function (vtk_module_install_headers) 3717 cmake_parse_arguments(_vtk_install_headers 3723 if (_vtk_install_headers_UNPARSED_ARGUMENTS) 3726 "${_vtk_install_headers_UNPARSED_ARGUMENTS}
") 3729 if (NOT _vtk_build_INSTALL_HEADERS) 3733 if (NOT _vtk_install_headers_FILES AND NOT _vtk_install_headers_DIRECTORIES) 3737 set(_vtk_install_headers_destination 3738 "${_vtk_build_HEADERS_DESTINATION}/${_vtk_install_headers_SUBDIR}
") 3739 if (_vtk_install_headers_FILES) 3741 FILES ${_vtk_install_headers_FILES} 3742 DESTINATION "${_vtk_install_headers_destination}
" 3743 COMPONENT "${_vtk_build_HEADERS_COMPONENT}
") 3745 foreach (_vtk_install_headers_directory IN LISTS _vtk_install_headers_DIRECTORIES) 3747 DIRECTORY "${_vtk_install_headers_directory}
" 3748 DESTINATION "${_vtk_install_headers_destination}
" 3749 COMPONENT "${_vtk_build_HEADERS_COMPONENT}
") 3754 @ingroup module-internal 3755 @brief Apply properties to a module 3757 Apply build properties to a target. Generally only useful to wrapping code or 3758 other modules that cannot use @ref vtk_module_add_module for some reason. 3761 _vtk_module_apply_properties(<target> 3762 [BASENAME <basename>]) 3765 If `BASENAME` is given, it will be used instead of the target name as the basis 3766 for `OUTPUT_NAME`. Full modules (as opposed to third party or other non-module 3767 libraries) always use the module's `LIBRARY_NAME` setting. 3769 The following target properties are set based on the arguments to the calling 3770 @ref vtk_module_build call: 3772 - `OUTPUT_NAME` (based on the module's `LIBRARY_NAME` and 3773 `vtk_module_build(LIBRARY_NAME_SUFFIX)`) 3774 - `VERSION` (based on `vtk_module_build(VERSION)`) 3775 - `SOVERSION` (based on `vtk_module_build(SOVERSION)`) 3776 - `DEBUG_POSTFIX` (on Windows) 3778 function (_vtk_module_apply_properties target) 3779 cmake_parse_arguments(_vtk_apply_properties 3785 if (_vtk_apply_properties_UNPARSED_ARGUMENTS) 3788 "${_vtk_apply_properties_UNPARSED_ARGUMENTS}.
") 3791 if (NOT DEFINED _vtk_apply_properties_BASENAME) 3792 set(_vtk_apply_properties_BASENAME "${
target}
") 3795 get_property(_vtk_add_module_type 3798 if (_vtk_add_module_type STREQUAL "OBJECT_LIBRARY
" OR 3799 _vtk_add_module_type STREQUAL "INTERFACE_LIBRARY
") 3803 set(_vtk_add_module_library_name "${_vtk_apply_properties_BASENAME}
") 3804 get_property(_vtk_add_module_target_name GLOBAL 3805 PROPERTY "_vtk_module_${_vtk_build_module}_target_name
") 3806 if (_vtk_add_module_target_name STREQUAL "${
target}
") 3807 get_property(_vtk_add_module_library_name GLOBAL 3808 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
") 3810 set(_vtk_add_module_output_name "${_vtk_add_module_library_name}${_vtk_add_module_LIBRARY_NAME_SUFFIX}
") 3811 if (_vtk_build_LIBRARY_NAME_SUFFIX) 3812 string(APPEND _vtk_add_module_output_name "-${_vtk_build_LIBRARY_NAME_SUFFIX}
") 3815 set_target_properties("${
target}
" 3817 OUTPUT_NAME "${_vtk_add_module_output_name}
") 3819 if (_vtk_build_VERSION AND NOT _vtk_add_module_type STREQUAL "EXECUTABLE
") 3820 set_target_properties("${
target}
" 3822 VERSION "${_vtk_build_VERSION}
") 3825 if (_vtk_build_SOVERSION) 3826 set_target_properties("${
target}
" 3828 SOVERSION "${_vtk_build_SOVERSION}
") 3832 set_target_properties("${
target}
" 3839 @ingroup module-internal 3840 @brief Install a module target 3842 Install a target within the module context. Generally only useful to wrapping 3843 code, modules that cannot use @ref vtk_module_add_module for some reason, or 3844 modules which create utility targets that need installed. 3847 _vtk_module_install(<target>) 3850 This function uses the various installation options to @ref vtk_module_build 3851 function to keep the install uniform. 3853 function (_vtk_module_install target) 3854 set(_vtk_install_export) 3855 if (_vtk_build_INSTALL_EXPORT) 3856 set(_vtk_install_export 3857 EXPORT "${_vtk_build_INSTALL_EXPORT}
") 3860 set(_vtk_install_namelink_args) 3861 if(NOT CMAKE_VERSION VERSION_LESS 3.12) 3862 list(APPEND _vtk_install_namelink_args 3863 NAMELINK_COMPONENT "${_vtk_build_HEADERS_COMPONENT}
") 3867 ${_vtk_install_export} 3870 DESTINATION "${_vtk_build_ARCHIVE_DESTINATION}
" 3871 COMPONENT "${_vtk_build_HEADERS_COMPONENT}
" 3873 DESTINATION "${_vtk_build_LIBRARY_DESTINATION}
" 3874 COMPONENT "${_vtk_build_TARGETS_COMPONENT}
" 3875 ${_vtk_install_namelink_args} 3877 DESTINATION "${_vtk_build_RUNTIME_DESTINATION}
" 3878 COMPONENT "${_vtk_build_TARGETS_COMPONENT}
") 3883 @brief Create a module executable 3885 Some modules may have associated executables with them. By using this function, 3886 the target will be installed following the options given to the associated 3887 @ref vtk_module_build command. Its name will also be changed according to the 3888 `LIBRARY_NAME_SUFFIX` option. 3891 vtk_module_add_executable(<name> 3894 [BASENAME <basename>] 3898 If `NO_INSTALL` is specified, the executable will not be installed. If 3899 `BASENAME` is given, it will be used as the name of the executable rather than 3902 If `DEVELOPMENT` is given, it marks the executable as a development tool and 3903 will not be installed if `INSTALL_HEADERS` is not set for the associated 3904 @ref vtk_module_build command. 3906 If the executable being built is the module, its module properties are used 3907 rather than `BASENAME`. In addition, the dependencies of the module will be 3910 function (vtk_module_add_executable name) 3911 cmake_parse_arguments(_vtk_add_executable 3912 "NO_INSTALL;DEVELOPMENT
" 3917 if (NOT _vtk_add_executable_UNPARSED_ARGUMENTS) 3919 "The ${
name} executable must have at least one
source file.
") 3922 if (_vtk_add_executable_NO_INSTALL AND _vtk_add_executable_DEVELOPMENT) 3924 "Both `NO_INSTALL` and `DEVELOPMENT` may not be specified.
") 3927 set(_vtk_add_executable_target_name "${
name}
") 3928 set(_vtk_add_executable_library_name "${
name}
") 3929 if (name STREQUAL _vtk_build_module) 3930 if (_vtk_add_executable_NO_INSTALL) 3932 "The executable ${_vtk_build_module} module may not use `NO_INSTALL`.
") 3934 if (DEFINED _vtk_add_executable_BASENAME) 3936 "The executable ${_vtk_build_module} module may not pass `BASENAME`
" 3937 "when adding the executable; it is controlled via `LIBRARY_NAME` in
" 3938 "the associated `
vtk.module` file.
") 3940 get_property(_vtk_add_executable_target_name GLOBAL 3941 PROPERTY "_vtk_module_${_vtk_build_module}_target_name
") 3942 get_property(_vtk_add_executable_library_name GLOBAL 3943 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
") 3946 if (_vtk_add_executable_DEVELOPMENT AND NOT _vtk_build_INSTALL_HEADERS) 3947 set(_vtk_add_executable_NO_INSTALL ON) 3951 set(CMAKE_BUILD_RPATH_USE_ORIGIN 1) 3953 file(RELATIVE_PATH _vtk_add_executable_relpath 3954 "/prefix/${_vtk_build_RUNTIME_DESTINATION}
" 3955 "/prefix/${_vtk_build_LIBRARY_DESTINATION}
") 3957 set(_vtk_add_executable_origin_rpath_prefix 3960 set(_vtk_add_executable_origin_rpath_prefix 3964 list(APPEND CMAKE_INSTALL_RPATH 3965 "${_vtk_add_executable_origin_rpath_prefix}/${_vtk_add_executable_relpath}
") 3968 add_executable("${_vtk_add_executable_target_name}
" 3969 ${_vtk_add_executable_UNPARSED_ARGUMENTS}) 3971 if (name STREQUAL _vtk_build_module AND NOT _vtk_add_executable_target_name STREQUAL _vtk_build_module) 3972 add_executable("${_vtk_build_module}
" ALIAS 3973 "${_vtk_add_executable_target_name}
") 3976 if (name STREQUAL _vtk_build_module) 3977 get_property(_vtk_real_target_kit GLOBAL 3978 PROPERTY "_vtk_module_${_vtk_build_module}_kit
") 3979 if (_vtk_real_target_kit) 3981 "Executable module ${_vtk_build_module} is declared to be part of a
" 3982 "kit;
this is not possible.
") 3985 get_property(_vtk_add_executable_depends GLOBAL 3986 PROPERTY "_vtk_module_${_vtk_build_module}_depends
") 3987 get_property(_vtk_add_executable_private_depends GLOBAL 3988 PROPERTY "_vtk_module_${_vtk_build_module}_private_depends
") 3989 target_link_libraries("${_vtk_add_executable_target_name}
" 3991 ${_vtk_add_executable_depends} 3993 ${_vtk_add_executable_private_depends}) 3994 get_property(_vtk_add_executable_optional_depends GLOBAL 3995 PROPERTY "_vtk_module_${_vtk_build_module}_optional_depends
") 3996 foreach (_vtk_add_executable_optional_depend IN LISTS _vtk_add_executable_optional_depends) 3997 string(REPLACE "::
" "_
" _vtk_add_executable_optional_depend_safe "${_vtk_add_executable_optional_depend}
") 3998 if (TARGET "${_vtk_add_executable_optional_depend}
") 3999 set(_vtk_add_executable_have_optional_depend 1) 4001 set(_vtk_add_executable_have_optional_depend 0) 4003 target_compile_definitions("${_vtk_add_executable_target_name}
" 4005 "VTK_MODULE_ENABLE_${_vtk_add_executable_optional_depend_safe}=${_vtk_add_executable_have_optional_depend}
") 4008 if (_vtk_module_warnings) 4009 if (_vtk_add_executable_depends) 4011 "Executable module ${_vtk_build_module} has
public dependencies;
this " 4012 "shouldn
't be necessary.") 4017 set(_vtk_add_executable_property_args) 4018 if (DEFINED _vtk_add_executable_BASENAME) 4019 list(APPEND _vtk_add_executable_property_args 4020 BASENAME "${_vtk_add_executable_BASENAME}") 4023 _vtk_module_apply_properties("${_vtk_add_executable_target_name}" 4024 ${_vtk_add_executable_property_args}) 4025 _vtk_module_standard_includes(TARGET "${_vtk_add_executable_target_name}") 4027 if (NOT _vtk_add_executable_NO_INSTALL) 4028 _vtk_module_install("${_vtk_add_executable_target_name}") 4034 @brief Find a package 4036 A wrapper around `find_package` that records information for use so that the 4037 same targets may be found when finding this package. 4039 Modules may need to find external dependencies. CMake often provides modules to 4040 find these dependencies, but when imported targets are involved, these.need to 4041 also be found from dependencies of the current project. Since the benefits of 4042 imported targets greatly outweighs not using them, it is preferred to use them. 4044 The module system provides the @ref vtk_module_find_package function in order 4045 to extend `find_package` support to include finding the dependencies from an 4046 install of the project. 4049 vtk_module_find_package( 4050 [PRIVATE] [CONFIG_MODE] 4053 [COMPONENTS <component>...] 4054 [OPTIONAL_COMPONENTS <component>...] 4055 [FORWARD_VERSION_REQ <MAJOR|MINOR|PATCH|EXACT>] 4056 [VERSION_VAR <variable>]) 4059 * `PACKAGE`: The name of the package to find. 4060 * `VERSION`: The minimum version of the package that is required. 4061 * `COMPONENTS`: Components of the package which are required. 4062 * `OPTIONAL_COMPONENTS`: Components of the package which may be missing. 4063 * `FORWARD_VERSION_REQ`: If provided, the found version will be promoted to 4064 the minimum version required matching the given version scheme. 4065 * `VERSION_VAR`: The variable to use as the provided version (defaults to 4066 `<PACKAGE>_VERSION`). It may contain `@` in which case it will be 4067 configured. This is useful for modules which only provide components of the 4068 actual version number. 4069 * `CONFIG_MODE`: If present, pass `CONFIG` to the underlying `find_package` 4071 * `PRIVATE`: The dependency should not be exported to the install. 4073 The `PACKAGE` argument is the only required argument. The rest are optional. 4075 Note that `PRIVATE` is *only* applicable for private dependencies on interface 4076 targets (basically, header libraries) because some platforms require private 4077 shared libraries dependencies to be present when linking dependent libraries 4078 and executables as well. 4080 macro (vtk_module_find_package) 4081 # This needs to be a macro because find modules typically set variables which 4082 # may need to be available in the calling scope. If we declare that it only 4083 # works with imported targets (which is the primary motivating factor behind 4084 # this function), we can instead make it a function at the cost of any 4085 # non-target variables a module might want to set being available. It is 4086 # unlikely that this will be the case for all callers. 4087 if (NOT _vtk_build_module) 4089 "`vtk_module_find_package` may only be called when building a VTK " 4093 # Note: when adding arguments here, add them to the `unset` block at the end 4095 cmake_parse_arguments(_vtk_find_package 4096 "PRIVATE;CONFIG_MODE" 4097 "PACKAGE;VERSION;FORWARD_VERSION_REQ;VERSION_VAR" 4098 "COMPONENTS;OPTIONAL_COMPONENTS" 4101 if (_vtk_find_package_UNPARSED_ARGUMENTS) 4103 "Unparsed arguments for vtk_module_find_package: " 4104 "${_vtk_find_package_UNPARSED_ARGUMENTS}") 4107 if (NOT DEFINED _vtk_find_package_PACKAGE) 4109 "The `PACKAGE` argument is required.") 4112 if (DEFINED _vtk_find_package_FORWARD_VERSION_REQ) 4113 if (_vtk_find_package_PRIVATE) 4115 "The `FORWARD_VERSION_REQ` argument is incompatible with the " 4119 if (NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MAJOR" AND 4120 NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MINOR" AND 4121 NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "PATCH" AND 4122 NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "EXACT") 4124 "The `FORWARD_VERSION_REQ` argument must be one of `MAJOR`, `MINOR`, " 4125 "`PATCH`, or `EXACT`.") 4129 if (NOT DEFINED _vtk_find_package_VERSION_VAR) 4130 set(_vtk_find_package_VERSION_VAR 4131 "${_vtk_find_package_PACKAGE}_VERSION") 4134 set(_vtk_find_package_config) 4135 if (_vtk_find_package_CONFIG_MODE) 4136 set(_vtk_find_package_config "CONFIG") 4139 find_package("${_vtk_find_package_PACKAGE}" 4140 ${_vtk_find_package_VERSION} 4141 ${_vtk_find_package_config} 4142 COMPONENTS ${_vtk_find_package_COMPONENTS} 4143 OPTIONAL_COMPONENTS ${_vtk_find_package_OPTIONAL_COMPONENTS}) 4144 if (NOT ${_vtk_find_package_PACKAGE}_FOUND) 4146 "Could not find the ${_vtk_find_package_PACKAGE} external dependency.") 4150 set(_vtk_find_package_optional_components_found) 4151 foreach (_vtk_find_package_optional_component IN LISTS _vtk_find_package_OPTIONAL_COMPONENTS) 4152 if (${_vtk_find_package_PACKAGE}_${_vtk_find_package_optional_component}_FOUND) 4153 list(APPEND _vtk_find_package_optional_components_found 4154 "${_vtk_find_package_optional_component}") 4158 if (NOT _vtk_find_package_PRIVATE) 4159 set_property(GLOBAL APPEND 4161 "_vtk_module_find_packages_${_vtk_build_PACKAGE}" "${_vtk_find_package_PACKAGE}") 4162 set(_vtk_find_package_base "_vtk_module_find_package_${_vtk_build_module}") 4163 set_property(GLOBAL APPEND 4165 "${_vtk_find_package_base}" "${_vtk_find_package_PACKAGE}") 4166 set(_vtk_find_package_base_package "${_vtk_find_package_base}_${_vtk_find_package_PACKAGE}") 4169 "${_vtk_find_package_base_package}_version" "${_vtk_find_package_VERSION}") 4172 "${_vtk_find_package_base_package}_config" "${_vtk_find_package_CONFIG_MODE}") 4173 set_property(GLOBAL APPEND 4175 "${_vtk_find_package_base_package}_components" "${_vtk_find_package_COMPONENTS}") 4176 set_property(GLOBAL APPEND 4178 "${_vtk_find_package_base_package}_optional_components" "${_vtk_find_package_OPTIONAL_COMPONENTS}") 4179 set_property(GLOBAL APPEND 4181 "${_vtk_find_package_base_package}_optional_components_found" "${_vtk_find_package_optional_components_found}") 4184 "${_vtk_find_package_base_package}_exact" "0") 4185 if (DEFINED _vtk_find_package_FORWARD_VERSION_REQ) 4186 string(FIND "${_vtk_find_package_VERSION_VAR}" "@" _vtk_find_package_idx) 4187 if (_vtk_find_package_idx EQUAL -1) 4188 if (NOT DEFINED "${_vtk_find_package_VERSION_VAR}") 4190 "The `${_vtk_find_package_VERSION_VAR}` variable is not defined.") 4192 set(_vtk_find_package_version "${${_vtk_find_package_VERSION_VAR}}") 4194 string(CONFIGURE "${_vtk_find_package_VERSION_VAR}" _vtk_find_package_version) 4196 unset(_vtk_find_package_idx) 4198 if ("${_vtk_find_package_version}" STREQUAL "") 4200 "The `${_vtk_find_package_PACKAGE}` version is empty.") 4203 if (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MAJOR") 4204 set(_vtk_find_package_version_regex "^\([^.]*\).*") 4205 elseif (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MINOR") 4206 set(_vtk_find_package_version_regex "^\([^.]*.[^.]*\).*") 4207 elseif (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "PATCH") 4208 set(_vtk_find_package_version_regex "^\([^.]*.[^.]*.[^.]*\).*") 4209 elseif (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "EXACT") 4210 set(_vtk_find_package_version_regex "^\\(.*\\)$") 4213 "${_vtk_find_package_base_package}_exact" "1") 4216 string(REGEX REPLACE "${_vtk_find_package_version_regex}" "\\1" 4217 _vtk_find_package_found_version "${_vtk_find_package_version}") 4218 unset(_vtk_find_package_version_regex) 4219 unset(_vtk_find_package_version) 4223 "${_vtk_find_package_base_package}_version" "${_vtk_find_package_found_version}") 4224 unset(_vtk_find_package_found_version) 4228 unset(_vtk_find_package_base) 4229 unset(_vtk_find_package_base_package) 4230 unset(_vtk_find_package_COMPONENTS) 4231 unset(_vtk_find_package_FORWARD_VERSION_REQ) 4232 unset(_vtk_find_package_OPTIONAL_COMPONENTS) 4233 unset(_vtk_find_package_PACKAGE) 4234 unset(_vtk_find_package_PRIVATE) 4235 unset(_vtk_find_package_UNPARSED_ARGUMENTS) 4236 unset(_vtk_find_package_VERSION) 4237 unset(_vtk_find_package_VERSION_VAR) 4242 @brief Export find_package calls for dependencies 4244 When installing a project that is meant to be found via `find_package` from 4245 CMake, using imported targets in the build means that imported targets need to 4246 be created during the `find_package` as well. This function writes a file 4247 suitable for inclusion from a `<package>-config.cmake` file to satisfy 4248 dependencies. It assumes that the exported targets are named 4249 `${CMAKE_FIND_PACKAGE_NAME}::${component}`. Dependent packages will only be 4250 found if a requested component requires the package to be found either directly 4254 vtk_module_export_find_packages( 4255 CMAKE_DESTINATION <directory> 4256 FILE_NAME <filename> 4257 [COMPONENT <component>] 4258 MODULES <module>...) 4261 The file will be named according to the `FILE_NAME` argument will be installed 4262 into `CMAKE_DESTINATION` in the build and install trees with the given 4263 filename. If not provided, the `development` component will be used. 4265 The `vtk_module_find_package` calls made by the modules listed in `MODULES` 4266 will be exported to this file. 4268 function (vtk_module_export_find_packages) 4269 cmake_parse_arguments(_vtk_export 4271 "CMAKE_DESTINATION;FILE_NAME;COMPONENT" 4275 if (_vtk_export_UNPARSED_ARGUMENTS) 4277 "Unparsed arguments for vtk_module_export_find_packages: " 4278 "${_vtk_export_UNPARSED_ARGUMENTS}") 4281 if (NOT DEFINED _vtk_export_CMAKE_DESTINATION) 4283 "The `CMAKE_DESTINATION` is required.") 4286 if (NOT DEFINED _vtk_export_FILE_NAME) 4288 "The `FILE_NAME` is required.") 4291 if (NOT DEFINED _vtk_export_COMPONENT) 4292 set(_vtk_export_COMPONENT "development") 4295 set(_vtk_export_output_file 4296 "${CMAKE_BINARY_DIR}/${_vtk_export_CMAKE_DESTINATION}/${_vtk_export_FILE_NAME}") 4297 file(WRITE "${_vtk_export_output_file}" 4298 "set(_vtk_module_find_package_quiet) 4299 if (\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) 4300 set(_vtk_module_find_package_quiet QUIET) 4303 set(_vtk_module_find_package_components_checked) 4304 set(_vtk_module_find_package_components_to_check 4305 \${\${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS}) 4306 set(_vtk_module_find_package_components) 4307 set(_vtk_module_find_package_components_required) 4308 while (_vtk_module_find_package_components_to_check) 4309 list(GET _vtk_module_find_package_components_to_check 0 _vtk_module_component) 4310 list(REMOVE_AT _vtk_module_find_package_components_to_check 0) 4311 if (_vtk_module_component IN_LIST _vtk_module_find_package_components_checked) 4314 list(APPEND _vtk_module_find_package_components_checked 4315 \"\${_vtk_module_component}\") 4317 list(APPEND _vtk_module_find_package_components 4318 \"\${_vtk_module_component}\") 4319 if (\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_\${_vtk_module_component}) 4320 list(APPEND _vtk_module_find_package_components_required 4321 \"\${_vtk_module_component}\") 4324 if (TARGET \"\${CMAKE_FIND_PACKAGE_NAME}::\${_vtk_module_component}\") 4325 set(_vtk_module_find_package_component_target \"\${CMAKE_FIND_PACKAGE_NAME}::\${_vtk_module_component}\") 4326 elseif (TARGET \"\${_vtk_module_component}\") 4327 set(_vtk_module_find_package_component_target \"\${_vtk_module_component}\") 4329 # No such target for the component; skip. 4332 get_property(_vtk_module_find_package_depends 4333 TARGET \"\${_vtk_module_find_package_component_target}\" 4334 PROPERTY \"INTERFACE_vtk_module_depends\") 4335 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depends \"\${_vtk_module_find_package_depends}\") 4336 list(APPEND _vtk_module_find_package_components_to_check 4337 \${_vtk_module_find_package_depends}) 4338 get_property(_vtk_module_find_package_depends 4339 TARGET \"\${_vtk_module_find_package_component_target}\" 4340 PROPERTY \"INTERFACE_vtk_module_private_depends\") 4341 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depends \"\${_vtk_module_find_package_depends}\") 4342 list(APPEND _vtk_module_find_package_components_to_check 4343 \${_vtk_module_find_package_depends}) 4344 get_property(_vtk_module_find_package_depends 4345 TARGET \"\${_vtk_module_find_package_component_target}\" 4346 PROPERTY \"INTERFACE_vtk_module_optional_depends\") 4347 foreach (_vtk_module_find_package_depend IN LISTS _vtk_module_find_package_depends) 4348 if (TARGET \"\${_vtk_module_find_package_depend}\") 4349 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depend \"\${_vtk_module_find_package_depend}\") 4350 list(APPEND _vtk_module_find_package_components_to_check 4351 \"\${_vtk_module_find_package_depend}\") 4354 get_property(_vtk_module_find_package_depends 4355 TARGET \"\${_vtk_module_find_package_component_target}\" 4356 PROPERTY \"INTERFACE_vtk_module_forward_link\") 4357 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depends \"\${_vtk_module_find_package_depends}\") 4358 list(APPEND _vtk_module_find_package_components_to_check 4359 \${_vtk_module_find_package_depends}) 4361 get_property(_vtk_module_find_package_kit 4362 TARGET \"\${_vtk_module_find_package_component_target}\" 4363 PROPERTY \"INTERFACE_vtk_module_kit\") 4364 if (_vtk_module_find_package_kit) 4365 get_property(_vtk_module_find_package_kit_modules 4366 TARGET \"\${_vtk_module_find_package_kit}\" 4367 PROPERTY \"INTERFACE_vtk_kit_kit_modules\") 4368 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_kit_modules \"\${_vtk_module_find_package_kit_modules}\") 4369 list(APPEND _vtk_module_find_package_components_to_check 4370 \${_vtk_module_find_package_kit_modules}) 4373 unset(_vtk_module_find_package_component_target) 4374 unset(_vtk_module_find_package_components_to_check) 4375 unset(_vtk_module_find_package_components_checked) 4376 unset(_vtk_module_component) 4377 unset(_vtk_module_find_package_depend) 4378 unset(_vtk_module_find_package_depends) 4379 unset(_vtk_module_find_package_kit) 4380 unset(_vtk_module_find_package_kit_modules) 4382 if (_vtk_module_find_package_components) 4383 list(REMOVE_DUPLICATES _vtk_module_find_package_components) 4385 if (_vtk_module_find_package_components_required) 4386 list(REMOVE_DUPLICATES _vtk_module_find_package_components_required) 4389 foreach (_vtk_export_module IN LISTS _vtk_export_MODULES) 4390 get_property(_vtk_export_target_name GLOBAL 4391 PROPERTY "_vtk_module_${_vtk_export_module}_target_name") 4392 set(_vtk_export_base "_vtk_module_find_package_${_vtk_export_module}") 4393 get_property(_vtk_export_packages GLOBAL 4394 PROPERTY "${_vtk_export_base}") 4395 if (NOT _vtk_export_packages) 4399 file(APPEND "${_vtk_export_output_file}" 4400 "set(_vtk_module_find_package_enabled OFF) 4401 set(_vtk_module_find_package_is_required OFF) 4402 set(_vtk_module_find_package_fail_if_not_found OFF) 4403 if (_vtk_module_find_package_components) 4404 if (\"${_vtk_export_target_name}\" IN_LIST _vtk_module_find_package_components) 4405 set(_vtk_module_find_package_enabled ON) 4406 if (\"${_vtk_export_target_name}\" IN_LIST _vtk_module_find_package_components_required) 4407 set(_vtk_module_find_package_is_required \"\${\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED}\") 4408 set(_vtk_module_find_package_fail_if_not_found ON) 4412 set(_vtk_module_find_package_enabled ON) 4413 set(_vtk_module_find_package_is_required \"\${\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED}\") 4414 set(_vtk_module_find_package_fail_if_not_found ON) 4417 if (_vtk_module_find_package_enabled) 4418 set(_vtk_module_find_package_required) 4419 if (_vtk_module_find_package_is_required) 4420 set(_vtk_module_find_package_required REQUIRED) 4423 list(REMOVE_DUPLICATES _vtk_export_packages) 4424 foreach (_vtk_export_package IN LISTS _vtk_export_packages) 4425 set(_vtk_export_base_package "${_vtk_export_base}_${_vtk_export_package}") 4426 get_property(_vtk_export_version GLOBAL 4427 PROPERTY "${_vtk_export_base_package}_version") 4428 get_property(_vtk_export_config GLOBAL 4429 PROPERTY "${_vtk_export_base_package}_config") 4430 get_property(_vtk_export_exact GLOBAL 4431 PROPERTY "${_vtk_export_base_package}_exact") 4432 get_property(_vtk_export_components GLOBAL 4433 PROPERTY "${_vtk_export_base_package}_components") 4434 get_property(_vtk_export_optional_components GLOBAL 4435 PROPERTY "${_vtk_export_base_package}_optional_components") 4436 get_property(_vtk_export_optional_components_found GLOBAL 4437 PROPERTY "${_vtk_export_base_package}_optional_components_found") 4439 # Assume that any found optional components end up being required. 4440 if (${_vtk_export_base_package}_optional_components_found) 4441 list(REMOVE_ITEM _vtk_export_optional_components 4442 ${_vtk_export_optional_components_found}) 4443 list(APPEND _vtk_export_components 4444 ${_vtk_export_optional_components_found}) 4447 set(_vtk_export_config_arg) 4448 if (_vtk_export_config) 4449 set(_vtk_export_config_arg CONFIG) 4452 set(_vtk_export_exact_arg) 4453 if (_vtk_export_exact) 4454 set(_vtk_export_exact_arg EXACT) 4457 file(APPEND "${_vtk_export_output_file}" 4458 " find_package(${_vtk_export_package} 4459 ${_vtk_export_version} 4460 ${_vtk_export_exact_arg} 4461 ${_vtk_export_config_arg} 4462 \${_vtk_module_find_package_quiet} 4463 \${_vtk_module_find_package_required} 4464 COMPONENTS ${_vtk_export_components} 4465 OPTIONAL_COMPONENTS ${_vtk_export_optional_components}) 4466 if (NOT ${_vtk_export_package}_FOUND AND _vtk_module_find_package_fail_if_not_found) 4467 if (NOT \${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) 4469 \"Could not find the \${CMAKE_FIND_PACKAGE_NAME} package due to a \" 4470 \"missing dependency: ${_vtk_export_package}\") 4472 set(\"\${CMAKE_FIND_PACKAGE_NAME}_${_vtk_export_target_name}_FOUND\" 0) 4473 list(APPEND \"\${CMAKE_FIND_PACKAGE_NAME}_${_vtk_export_target_name}_NOT_FOUND_MESSAGE\" 4474 \"Failed to find the ${_vtk_export_package} package.\") 4478 file(APPEND "${_vtk_export_output_file}" 4481 unset(_vtk_module_find_package_fail_if_not_found) 4482 unset(_vtk_module_find_package_enabled) 4483 unset(_vtk_module_find_package_required)\n\n") 4487 file(APPEND "${_vtk_export_output_file}" 4488 "unset(_vtk_module_find_package_components) 4489 unset(_vtk_module_find_package_components_required) 4490 unset(_vtk_module_find_package_quiet)\n") 4493 FILES "${CMAKE_BINARY_DIR}/${_vtk_export_CMAKE_DESTINATION}/${_vtk_export_FILE_NAME}" 4494 DESTINATION "${_vtk_export_CMAKE_DESTINATION}" 4495 COMPONENT "${_vtk_export_COMPONENT}") 4499 @page module-overview 4502 @section module-third-party Third party support 4504 The module system acknowledges that third party support is a pain and offers 4505 APIs to help wrangle them. Sometimes third party code needs a shim introduced 4506 to make it behave better, so an `INTERFACE` library to add that in is very 4507 useful. Other times, third party code is hard to ensure that it exists 4508 everywhere, so it is bundled. When that happens, the ability to select between 4509 the bundled copy and an external copy is useful. All three (and more) of these 4512 The following functions are used to handle third party modules: 4514 - @ref vtk_module_third_party 4515 - @ref vtk_module_third_party_external 4516 - @ref vtk_module_third_party_internal 4521 @brief Third party module 4523 When a project has modules which represent third party packages, there are some 4524 convenience functions to help deal with them. First, there is the meta-wrapper: 4527 vtk_module_third_party( 4528 [INTERNAL <internal arguments>...] 4529 [EXTERNAL <external arguments>...]) 4532 This offers a cache variable named `VTK_MODULE_USE_EXTERNAL_<module name>` that 4533 may be set to trigger between the internal copy and an externally provided 4534 copy. This is available as a local variable named 4535 `VTK_MODULE_USE_EXTERNAL_<library name>`. See the 4536 @ref vtk_module_third_party_external and @ref vtk_module_third_party_internal 4537 functions for the arguments supported by the `EXTERNAL` and `INTERNAL` 4538 arguments, respectively. 4540 function (vtk_module_third_party) 4541 cmake_parse_arguments(_vtk_third_party 4547 if (_vtk_third_party_UNPARSED_ARGUMENTS) 4549 "Unparsed arguments for vtk_module_third_party: " 4550 "${_vtk_third_party_UNPARSED_ARGUMENTS}") 4553 string(REPLACE "::" "_" _vtk_build_module_safe "${_vtk_build_module}") 4554 option("VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe}" 4555 "Use externally provided ${_vtk_build_module}" 4556 "${_vtk_build_USE_EXTERNAL}") 4557 mark_as_advanced("VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe}") 4558 get_property(_vtk_third_party_library_name GLOBAL 4559 PROPERTY "_vtk_module_${_vtk_build_module}_library_name") 4560 set("VTK_MODULE_USE_EXTERNAL_${_vtk_third_party_library_name}" 4561 "${VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe}}" 4564 if (VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe}) 4565 # XXX(cmake): https://gitlab.kitware.com/cmake/cmake/issues/16364. 4566 # Unset a variable which CMake doesn't like when switching between real
4567 # libraries (internal) and interface libraries (external). 4568 unset(
"${_vtk_build_module}_LIB_DEPENDS" CACHE)
4571 # Bubble up variables again.
4572 foreach (_vtk_third_party_variable IN LISTS _vtk_third_party_variables)
4573 set(
"${_vtk_third_party_variable}" 4574 "${${_vtk_third_party_variable}}" 4578 set(_vtk_third_party_has_external_support 1)
4584 @ingroup module-
impl 4585 @brief Mark a module as being third party
4587 Mark a module as being a third party module.
4595 set_target_properties(
"${target}" 4597 "INTERFACE_vtk_module_exclude_wrap" 1
4598 "INTERFACE_vtk_module_third_party" 1)
4603 @brief External third party
package 4605 A third party dependency may be expressed as a module using this function.
4606 Third party packages are found using CMake's `find_package` function. It is
4607 highly recommended that imported targets are used to make usage easier. The
4608 module itself will be created as an `INTERFACE` library which exposes the
4612 vtk_module_third_party_external(
4615 [COMPONENTS <component>...]
4616 [OPTIONAL_COMPONENTS <component>...]
4617 [INCLUDE_DIRS <path-or-variable>...]
4618 [LIBRARIES <target-or-variable>...]
4619 [DEFINITIONS <variable>...]
4620 [FORWARD_VERSION_REQ <MAJOR|MINOR|PATCH|EXACT>]
4621 [VERSION_VAR <version-spec>]
4622 [USE_VARIABLES <variable>...]
4624 [STANDARD_INCLUDE_DIRS])
4627 Only the `PACKAGE` argument is required. The arguments are as follows:
4629 * `PACKAGE`: (Required) The name of the package to find.
4630 * `VERSION`: If specified, the minimum version of the dependency that must be
4632 * `COMPONENTS`: The list of components to request from the package.
4633 * `OPTIONAL_COMPONENTS`: The list of optional components to request from the
4635 * `STANDARD_INCLUDE_DIRS`: If present, standard include directories will be
4636 added to the module target. This is usually only required if both internal
4637 and external are supported for a given dependency.
4638 * `INCLUDE_DIRS`: If specified, this is added as a `SYSTEM INTERFACE` include
4639 directory for the target. If a variable name is given, it will be
4641 * `LIBRARIES`: The libraries to link from the package. If a variable name is
4642 given, it will be dereferenced, however a warning that imported targets are
4643 not being used will be emitted.
4644 * `DEFINITIONS`: If specified, the given variables will be added to the
4645 target compile definitions interface.
4646 * `CONFIG_MODE`: Force `CONFIG` mode.
4647 * `FORWARD_VERSION_REQ` and `VERSION_VAR`: See documentation for
4648 @ref vtk_module_find_package.
4649 * `USE_VARIABLES`: List of variables from the `find_package` to make
4650 available to the caller.
4652 function (vtk_module_third_party_external)
4653 cmake_parse_arguments(_vtk_third_party_external
4654 "STANDARD_INCLUDE_DIRS;CONFIG_MODE
" 4655 "VERSION;PACKAGE;FORWARD_VERSION_REQ;VERSION_VAR
" 4656 "COMPONENTS;OPTIONAL_COMPONENTS;LIBRARIES;INCLUDE_DIRS;DEFINITIONS;TARGETS;USE_VARIABLES
" 4659 if (_vtk_third_party_external_UNPARSED_ARGUMENTS) 4662 "${_vtk_third_party_external_UNPARSED_ARGUMENTS}
") 4665 get_property(_vtk_third_party_external_is_third_party GLOBAL 4666 PROPERTY "_vtk_module_${_vtk_build_module}_third_party
") 4667 if (NOT _vtk_third_party_external_is_third_party) 4669 "The ${_vtk_build_module} has not been declared as a third party
" 4673 if (NOT DEFINED _vtk_third_party_external_PACKAGE) 4675 "The `PACKAGE` argument is required.
") 4678 set(_vtk_third_party_external_args) 4679 if (DEFINED _vtk_third_party_external_FORWARD_VERSION_REQ) 4680 list(APPEND _vtk_third_party_external_args 4681 FORWARD_VERSION_REQ "${_vtk_third_party_external_FORWARD_VERSION_REQ}
") 4683 if (DEFINED _vtk_third_party_external_VERSION_VAR) 4684 list(APPEND _vtk_third_party_external_args 4685 VERSION_VAR "${_vtk_third_party_external_VERSION_VAR}
") 4688 if (_vtk_third_party_external_TARGETS) 4689 set(_vtk_third_party_external_config_mode) 4690 if (_vtk_third_party_external_CONFIG_MODE) 4691 set(_vtk_third_party_external_config_mode "CONFIG_MODE
") 4694 # If we have targets, they must be exported to the install as well. 4695 vtk_module_find_package( 4696 PACKAGE "${_vtk_third_party_external_PACKAGE}
" 4697 VERSION "${_vtk_third_party_external_VERSION}
" 4698 COMPONENTS ${_vtk_third_party_external_COMPONENTS} 4699 OPTIONAL_COMPONENTS ${_vtk_third_party_external_OPTIONAL_COMPONENTS} 4700 ${_vtk_third_party_external_config_mode} 4701 ${_vtk_third_party_external_args}) 4703 set(_vtk_third_party_external_config) 4704 if (_vtk_third_party_external_CONFIG_MODE) 4705 set(_vtk_third_party_external_config "CONFIG
") 4708 # If there are no targets, the install uses strings and therefore does not 4709 # need to find the dependency again. 4710 find_package("${_vtk_third_party_external_PACKAGE}
" 4711 ${_vtk_third_party_external_VERSION} 4712 ${_vtk_third_party_external_config} 4713 COMPONENTS ${_vtk_third_party_external_COMPONENTS} 4714 OPTIONAL_COMPONENTS ${_vtk_third_party_external_OPTIONAL_COMPONENTS}) 4717 get_property(_vtk_third_party_external_target_name GLOBAL 4718 PROPERTY "_vtk_module_${_vtk_build_module}_target_name
") 4720 # Check if an imported target of the same name already exists. 4721 set(_vtk_third_party_external_real_target_name 4722 "${_vtk_third_party_external_target_name}
") 4723 set(_vtk_third_party_external_using_mangled_name OFF) 4724 if (TARGET "${_vtk_third_party_external_target_name}
") 4725 # Ensure that the target collision comes from an imported target. 4726 get_property(_vtk_third_party_external_is_imported 4727 TARGET "${_vtk_third_party_external_target_name}
" 4729 if (NOT _vtk_third_party_external_is_imported) 4731 "It appears as though there is a conflicting
target named
" 4732 "`${_vtk_third_party_external_target_name}` expected to be used by
" 4733 "the `${_vtk_build_module}` module already added to the build. This
" 4734 "conflicts with the
target name expected to be used by an external
" 4735 "third party dependency.
") 4738 # If it does, we need to have a module name that is not the same as this 4739 # one. Error out if this is detected. 4740 if (_vtk_build_module STREQUAL _vtk_third_party_external_target_name) 4742 "An imported
target has the same
name used by the module system
for " 4743 "the facade of the external dependency
for `${_vtk_build_module}`.
" 4744 "This module must be either renamed or placed into a
namespace.
") 4747 # Mangle the internal name. The alias is the expected use case anyways and 4748 # since this is an INTERFACE target, there's nothing to break with respect 4749 # to `make $target` anyways. 4750 string(APPEND _vtk_third_party_external_real_target_name 4751 "_vtk_module_mangle
") 4752 set_property(GLOBAL APPEND_STRING 4753 PROPERTY "_vtk_module_${_vtk_build_module}_target_name
" 4754 "_vtk_module_mangle
") 4755 set(_vtk_third_party_external_using_mangled_name ON) 4758 add_library("${_vtk_third_party_external_real_target_name}
" INTERFACE) 4759 if (_vtk_third_party_external_using_mangled_name) 4760 set_property(TARGET "${_vtk_third_party_external_real_target_name}
" 4762 EXPORT_NAME "${_vtk_third_party_external_target_name}
") 4764 if (NOT _vtk_build_module STREQUAL _vtk_third_party_external_target_name) 4765 add_library("${_vtk_build_module}
" ALIAS 4766 "${_vtk_third_party_external_real_target_name}
") 4769 if (_vtk_third_party_external_STANDARD_INCLUDE_DIRS) 4770 _vtk_module_standard_includes(TARGET "${_vtk_third_party_external_real_target_name}
" 4774 # Try to use targets if they're specified and available. 4775 set(_vtk_third_party_external_have_targets FALSE) 4776 set(_vtk_third_party_external_used_targets FALSE) 4777 if (_vtk_third_party_external_TARGETS) 4778 set(_vtk_third_party_external_have_targets TRUE) 4779 set(_vtk_third_party_external_all_targets_okay TRUE) 4780 foreach (_vtk_third_party_external_target IN LISTS _vtk_third_party_external_TARGETS) 4781 if (NOT TARGET "${_vtk_third_party_external_target}
") 4782 set(_vtk_third_party_external_all_targets_okay FALSE) 4787 if (_vtk_third_party_external_all_targets_okay) 4788 target_link_libraries("${_vtk_third_party_external_real_target_name}
" 4790 ${_vtk_third_party_external_TARGETS}) 4791 set(_vtk_third_party_external_used_targets TRUE) 4795 if (NOT _vtk_third_party_external_used_targets) 4796 if (NOT _vtk_third_party_external_have_targets) 4798 "A third party dependency
for ${_vtk_build_module} was found externally
" 4799 "using paths rather than targets; it is recommended to use imported
" 4800 "targets rather than find_library and such.
") 4803 set(_vtk_third_party_external_have_includes FALSE) 4804 foreach (_vtk_third_party_external_include_dir IN LISTS _vtk_third_party_external_INCLUDE_DIRS) 4805 if (DEFINED "${_vtk_third_party_external_include_dir}
") 4806 if (${_vtk_third_party_external_include_dir}) 4807 set(_vtk_third_party_external_have_includes TRUE) 4809 target_include_directories("${_vtk_third_party_external_real_target_name}
" SYSTEM 4810 INTERFACE "${${_vtk_third_party_external_include_dir}}
") 4814 if (_vtk_third_party_external_have_targets AND 4815 NOT _vtk_third_party_external_have_includes) 4817 "A third party dependency
for ${_vtk_build_module} has external targets
" 4818 "which were not found and no `INCLUDE_DIRS` were found either.
" 4819 "Including
this module may not work.
") 4822 foreach (_vtk_third_party_external_define IN LISTS _vtk_third_party_external_DEFINITIONS) 4823 if (DEFINED "${_vtk_third_party_external_define}
") 4824 target_compile_definitions("${_vtk_third_party_external_real_target_name}
" 4825 INTERFACE "${${_vtk_third_party_external_define}}
") 4829 set(_vtk_third_party_external_have_libraries FALSE) 4830 foreach (_vtk_third_party_external_library IN LISTS _vtk_third_party_external_LIBRARIES) 4831 if (DEFINED "${_vtk_third_party_external_library}
") 4832 if (${_vtk_third_party_external_library}) 4833 set(_vtk_third_party_external_have_libraries TRUE) 4835 target_link_libraries("${_vtk_third_party_external_real_target_name}
" 4836 INTERFACE "${${_vtk_third_party_external_library}}
") 4840 if (_vtk_third_party_external_have_targets AND 4841 NOT _vtk_third_party_external_have_libraries) 4843 "A third party dependency
for ${_vtk_build_module} has external targets
" 4844 "which were not found and no `LIBRARIES` were found either. Linking to
" 4845 "this this module may not work.
") 4849 if (DEFINED _vtk_third_party_external_USE_VARIABLES) 4850 # If we're called from `vtk_module_third_party`, the variables need bubbled 4852 if (DEFINED _vtk_third_party_EXTERNAL) 4853 set(_vtk_third_party_variables 4854 "${_vtk_third_party_external_USE_VARIABLES}
" 4858 foreach (_vtk_third_party_external_variable IN LISTS _vtk_third_party_external_USE_VARIABLES) 4859 if (NOT DEFINED "${_vtk_third_party_external_variable}
") 4861 "The variable `${_vtk_third_party_external_variable}` was expected
" 4862 "to have been available, but was not defined.
") 4865 set("${_vtk_third_party_external_variable}
" 4866 "${${_vtk_third_party_external_variable}}
" 4871 _vtk_module_mark_third_party("${_vtk_third_party_external_real_target_name}
") 4872 _vtk_module_install("${_vtk_third_party_external_real_target_name}
") 4877 @brief Internal third party package 4879 Third party modules may also be bundled with the project itself. In this case, 4880 it is an internal third party dependency. The dependency is assumed to be in a 4881 subdirectory that will be used via `add_subdirectory`. Unless it is marked as 4882 `HEADERS_ONLY`, it is assumed that it will create a target with the name of the 4886 vtk_module_third_party_internal( 4887 [SUBDIRECTORY <path>] 4888 [HEADERS_SUBDIR <subdir>] 4889 [LICENSE_FILES <file>...] 4893 [STANDARD_INCLUDE_DIRS]) 4896 All arguments are optional, however warnings are emitted if `LICENSE_FILES` or 4897 `VERSION` is not specified. They are as follows: 4899 * `SUBDIRECTORY`: (Defaults to the library name of the module) The 4900 subdirectory containing the `CMakeLists.txt` for the dependency. 4901 * `HEADERS_SUBDIR`: If non-empty, the subdirectory to use for installing 4903 * `LICENSE_FILES`: A list of license files to install for the dependency. If 4904 not given, a warning will be emitted. 4905 * `VERSION`: The version of the library that is included. 4906 * `HEADER_ONLY`: The dependency is header only and will not create a target. 4907 * `INTERFACE`: The dependency is an `INTERFACE` library. 4908 * `STANDARD_INCLUDE_DIRS`: If present, module-standard include directories 4909 will be added to the module target. 4911 function (vtk_module_third_party_internal) 4912 # TODO: Support scanning for third-party modules which don't support an 4915 cmake_parse_arguments(_vtk_third_party_internal 4916 "INTERFACE;HEADER_ONLY;STANDARD_INCLUDE_DIRS
" 4917 "SUBDIRECTORY;HEADERS_SUBDIR;VERSION
" 4921 if (_vtk_third_party_internal_UNPARSED_ARGUMENTS) 4924 "${_vtk_third_party_internal_UNPARSED_ARGUMENTS}
") 4927 get_property(_vtk_third_party_internal_is_third_party GLOBAL 4928 PROPERTY "_vtk_module_${_vtk_build_module}_third_party
") 4929 if (NOT _vtk_third_party_internal_is_third_party) 4931 "The ${_vtk_build_module} has not been declared as a third party
" 4935 get_property(_vtk_third_party_internal_library_name GLOBAL 4936 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
") 4937 if (NOT DEFINED _vtk_third_party_internal_SUBDIRECTORY) 4938 set(_vtk_third_party_internal_SUBDIRECTORY "${_vtk_third_party_internal_library_name}
") 4941 if (NOT DEFINED _vtk_third_party_internal_LICENSE_FILES) 4943 "The ${_vtk_build_module} third party
package is embedded, but does not "
4944 "specify any license files.")
4947 if (NOT DEFINED _vtk_third_party_internal_VERSION)
4949 "The ${_vtk_build_module} third party package is embedded, but does not "
4950 "specify the version it is based on.")
4953 get_property(_vtk_third_party_internal_target_name GLOBAL
4954 PROPERTY "_vtk_module_${_vtk_build_module}_target_name")
4955 set(_vtk_third_party_internal_include_type)
4956 if (_vtk_third_party_internal_INTERFACE)
4957 set(_vtk_third_party_internal_include_type INTERFACE)
4958 elseif (_vtk_third_party_internal_HEADER_ONLY)
4959 add_library("${_vtk_third_party_internal_target_name}" INTERFACE)
4960 if (NOT _vtk_build_module STREQUAL _vtk_third_party_internal_target_name)
4961 add_library("${_vtk_build_module}" ALIAS
4962 "${_vtk_third_party_internal_target_name}")
4964 set(_vtk_third_party_internal_include_type INTERFACE)
4965 set(_vtk_third_party_internal_STANDARD_INCLUDE_DIRS 1)
4968 add_subdirectory("${_vtk_third_party_internal_SUBDIRECTORY}")
4970 if (NOT TARGET "${_vtk_build_module}")
4972 "The ${_vtk_build_module} is being built as an internal third party "
4973 "library, but a matching target was not created.")
4976 if (_vtk_third_party_internal_STANDARD_INCLUDE_DIRS)
4977 _vtk_module_standard_includes(
4978 TARGET "${_vtk_third_party_internal_target_name}"
4979 SYSTEM ${_vtk_third_party_internal_include_type}
4980 HEADERS_DESTINATION "${_vtk_build_HEADERS_DESTINATION}/${_vtk_third_party_internal_HEADERS_SUBDIR}")
4983 _vtk_module_apply_properties("${_vtk_third_party_internal_target_name}")
4984 if (_vtk_third_party_internal_INTERFACE)
4986 elseif (_vtk_third_party_internal_HEADER_ONLY)
4987 _vtk_module_install("${_vtk_third_party_internal_target_name}")
4990 if (_vtk_third_party_internal_LICENSE_FILES)
4992 FILES ${_vtk_third_party_internal_LICENSE_FILES}
4993 DESTINATION "${_vtk_build_LICENSE_DESTINATION}/${_vtk_third_party_internal_library_name}/"
4994 COMPONENT "license")
4997 _vtk_module_mark_third_party("${_vtk_third_party_internal_target_name}")
function _vtk_module_debug(domain, format)
Conditionally output debug statements
function vtk_module_include(module)
Add include directories to a module
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph *>::edge_descriptor e, vtkGraph *)
function vtk_module_third_party_internal()
Internal third party package
function vtk_module_compile_options(module)
Add compile options to a module
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
function vtk_module_scan()
Scan modules and kits
function vtk_module_third_party_external()
External third party package
function vtk_module_build()
Build modules and kits
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph *>::edge_descriptor e, vtkGraph *)
function vtk_module_link(module)
Add link libraries to a module
function _vtk_module_real_target_kit(var, kit)
The real target for a kit
function vtk_module_install_headers()
Install headers
function _vtk_module_real_target(var, module)
The real target for a module
function _vtk_module_apply_properties(target)
Apply properties to a module
function vtk_module_get_property(module)
Get a property from a module
function _vtk_module_export_properties()
Export properties on modules and targets
function vtk_module_add_module(name)
Create a module library
function vtk_module_autoinit()
Linking to autoinit-using modules
function _vtk_module_set_module_property(module)
Set a module property
function vtk_module_link_options(module)
Add link options to a module
#define VTK_MODULE_AUTOINIT
function vtk_module_set_property(module)
Set a property on a module
function vtk_module_compile_features(module)
Add compile features to a module
function vtk_module_definitions(module)
Add compile definitions to a module
function _vtk_module_mark_third_party(target)
Mark a module as being third party