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(PARSE_ARGV 0 _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
") 531 if (_vtk_scan_UNPARSED_ARGUMENTS) 534 "${_vtk_scan_UNPARSED_ARGUMENTS}
") 537 if (NOT DEFINED _vtk_scan_WANT_BY_DEFAULT) 538 set(_vtk_scan_WANT_BY_DEFAULT OFF) 541 if (NOT DEFINED _vtk_scan_HIDE_MODULES_FROM_CACHE) 542 set(_vtk_scan_HIDE_MODULES_FROM_CACHE OFF) 545 if (NOT DEFINED _vtk_scan_PROVIDES_MODULES) 547 "The `PROVIDES_MODULES` argument is required.
") 550 if (NOT DEFINED _vtk_scan_PROVIDES_KITS AND _vtk_scan_KIT_FILES) 552 "The `PROVIDES_KITS` argument is required.
") 555 if (NOT DEFINED _vtk_scan_ENABLE_TESTS) 556 set(_vtk_scan_ENABLE_TESTS "WANT
") 559 if (NOT (_vtk_scan_ENABLE_TESTS STREQUAL "ON
" OR 560 _vtk_scan_ENABLE_TESTS STREQUAL "OFF
" OR 561 _vtk_scan_ENABLE_TESTS STREQUAL "WANT
" OR 562 _vtk_scan_ENABLE_TESTS STREQUAL "DEFAULT
")) 564 "The `ENABLE_TESTS` argument must be one of `ON`, `OFF`, `WANT`, or
" 565 "`DEFAULT`.
" "Received `${_vtk_scan_ENABLE_TESTS}`.
") 568 if (NOT _vtk_scan_MODULE_FILES) 570 "No module files given to scan.
") 573 set(_vtk_scan_option_default_type STRING) 574 if (_vtk_scan_HIDE_MODULES_FROM_CACHE) 575 set(_vtk_scan_option_default_type INTERNAL) 578 set(_vtk_scan_all_kits) 580 foreach (_vtk_scan_kit_file IN LISTS _vtk_scan_KIT_FILES) 581 if (NOT IS_ABSOLUTE "${_vtk_scan_kit_file}
") 582 string(PREPEND _vtk_scan_kit_file "${CMAKE_CURRENT_SOURCE_DIR}/
") 584 set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}
" APPEND 586 CMAKE_CONFIGURE_DEPENDS "${_vtk_scan_kit_file}
") 588 file(READ "${_vtk_scan_kit_file}
" _vtk_scan_kit_args) 590 string(REGEX REPLACE "#[^\n]*\n
" "\n
" _vtk_scan_kit_args "${_vtk_scan_kit_args}
") 591 # Use argument splitting. 592 string(REGEX REPLACE "( |\n)+
" ";
" _vtk_scan_kit_args "${_vtk_scan_kit_args}
") 593 _vtk_module_parse_kit_args(_vtk_scan_kit_name ${_vtk_scan_kit_args}) 594 _vtk_module_debug(kit "@_vtk_scan_kit_name@ declared by @_vtk_scan_kit_file
@") 596 list(APPEND _vtk_scan_all_kits 597 "${_vtk_scan_kit_name}
") 599 # Set properties for building. 602 "_vtk_kit_${_vtk_scan_kit_name}_namespace
" "${${_vtk_scan_kit_name}_NAMESPACE}
") 605 "_vtk_kit_${_vtk_scan_kit_name}_target_name
" "${${_vtk_scan_kit_name}_TARGET_NAME}
") 608 "_vtk_kit_${_vtk_scan_kit_name}_library_name
" "${${_vtk_scan_kit_name}_LIBRARY_NAME}
") 611 set(_vtk_scan_all_modules) 612 set(_vtk_scan_all_groups) 613 set(_vtk_scan_rejected_modules) 615 # Read all of the module files passed in. 616 foreach (_vtk_scan_module_file IN LISTS _vtk_scan_MODULE_FILES) 617 if (NOT IS_ABSOLUTE "${_vtk_scan_module_file}
") 618 string(PREPEND _vtk_scan_module_file "${CMAKE_CURRENT_SOURCE_DIR}/
") 620 set_property(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}
" APPEND 622 CMAKE_CONFIGURE_DEPENDS "${_vtk_scan_module_file}
") 624 file(READ "${_vtk_scan_module_file}
" _vtk_scan_module_args) 626 string(REGEX REPLACE "#[^\n]*\n
" "\n
" _vtk_scan_module_args "${_vtk_scan_module_args}
") 627 # Use argument splitting. 628 string(REGEX REPLACE "( |\n)+
" ";
" _vtk_scan_module_args "${_vtk_scan_module_args}
") 629 _vtk_module_parse_module_args(_vtk_scan_module_name ${_vtk_scan_module_args}) 630 _vtk_module_debug(module "@_vtk_scan_module_name@ declared by @_vtk_scan_module_file
@") 631 string(REPLACE "::
" "_
" _vtk_scan_module_name_safe "${_vtk_scan_module_name}
") 633 if (${_vtk_scan_module_name}_THIRD_PARTY) 634 if (_vtk_module_warnings) 635 if (${_vtk_scan_module_name}_EXCLUDE_WRAP) 637 "The third party ${_vtk_scan_module_name} module does not need to
" 638 "declare `EXCLUDE_WRAP` also.
") 641 if (${_vtk_scan_module_name}_IMPLEMENTABLE) 643 "The third party ${_vtk_scan_module_name} module may not be
" 646 if (${_vtk_scan_module_name}_IMPLEMENTS) 648 "The third party ${_vtk_scan_module_name} module may not
" 649 "`IMPLEMENTS` another module.
") 651 if (${_vtk_scan_module_name}_KIT) 653 "The third party ${_vtk_scan_module_name} module may not be part of
" 654 "a kit (${${_vtk_scan_module_name}_KIT}).
") 658 if (${_vtk_scan_module_name}_KIT) 659 if (NOT ${_vtk_scan_module_name}_KIT IN_LIST _vtk_scan_all_kits) 661 "The ${_vtk_scan_module_name} belongs to the
" 662 "${${_vtk_scan_module_name}_KIT} kit, but it has not been scanned.
") 666 # Check if the module is visible. Modules which have a failing condition 667 # are basically invisible. 668 if (DEFINED ${_vtk_scan_module_name}_CONDITION) 669 if (NOT (${${_vtk_scan_module_name}_CONDITION})) 670 if (DEFINED "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
") 671 set_property(CACHE "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
" 675 _vtk_module_debug(module "@_vtk_scan_module_name@ hidden by its `CONDITION`
") 680 # Determine whether we should provide a user-visible option for this 682 set(_vtk_build_use_option 1) 683 if (DEFINED _vtk_scan_REQUEST_MODULE) 684 if (_vtk_scan_module_name IN_LIST _vtk_scan_REQUEST_MODULE) 685 set("_vtk_scan_enable_${_vtk_scan_module_name}
" YES) 686 set(_vtk_build_use_option 0) 689 if (DEFINED _vtk_scan_REJECT_MODULES) 690 if (_vtk_scan_module_name IN_LIST _vtk_scan_REJECT_MODULES) 691 if (NOT _vtk_build_use_option) 693 "The ${_vtk_scan_module_name} module has been requested and rejected.
") 695 # Rejected modules should not have a build option. 696 set(_vtk_build_use_option 0) 697 list(APPEND _vtk_scan_rejected_modules 698 "${_vtk_scan_module_name}
") 702 # Handle cache entries and determine the enabled state of the module from 703 # the relevant cache variables. 704 if (_vtk_build_use_option) 705 set("VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
" "DEFAULT
" 706 CACHE STRING "Enable the ${_vtk_scan_module_name} module. ${${_vtk_scan_module_name}_DESCRIPTION}
") 707 mark_as_advanced("VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
") 708 set_property(CACHE "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
" 710 STRINGS "YES;WANT;DONT_WANT;NO;DEFAULT
") 711 _vtk_module_verify_enable_value("VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
") 713 if (NOT VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe} STREQUAL "DEFAULT
") 714 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "${VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}}
") 715 _vtk_module_debug(enable "@_vtk_scan_module_name@ is `${_vtk_scan_enable_${_vtk_scan_module_name}}` by cache
value") 718 # Check the state of any groups the module belongs to. 719 foreach (_vtk_scan_group IN LISTS "${_vtk_scan_module_name}_GROUPS
") 720 if (NOT DEFINED "VTK_GROUP_ENABLE_${_vtk_scan_group}
") 721 set(_vtk_scan_group_default "DEFAULT
") 722 if (DEFINED "_vtk_module_group_default_${_vtk_scan_group}
") 723 set(_vtk_scan_group_default "${_vtk_module_group_default_${_vtk_scan_group}}
") 725 set("VTK_GROUP_ENABLE_${_vtk_scan_group}
" "${_vtk_scan_group_default}
" 726 CACHE STRING "Enable the ${_vtk_scan_group} group modules.
") 727 set_property(CACHE "VTK_GROUP_ENABLE_${_vtk_scan_group}
" 729 STRINGS "YES;WANT;DONT_WANT;NO;DEFAULT
") 730 set_property(CACHE "VTK_GROUP_ENABLE_${_vtk_scan_group}
" 732 TYPE "${_vtk_scan_option_default_type}
") 734 _vtk_module_verify_enable_value("VTK_GROUP_ENABLE_${_vtk_scan_group}
") 736 if (NOT VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe} STREQUAL "DEFAULT
") 740 # Determine the state of the group. 741 set(_vtk_scan_group_enable "${VTK_GROUP_ENABLE_${_vtk_scan_group}}
") 742 if (NOT _vtk_scan_group_enable STREQUAL "DEFAULT
") 743 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "${_vtk_scan_group_enable}
") 744 _vtk_module_debug(enable "@_vtk_scan_module_name@ is DEFAULT,
using group `@_vtk_scan_group@` setting: @_vtk_scan_group_enable
@") 748 set_property(CACHE "VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe}
" 750 TYPE "${_vtk_scan_option_default_type}
") 753 if (NOT DEFINED "_vtk_scan_enable_${_vtk_scan_module_name}
" AND 754 VTK_MODULE_ENABLE_${_vtk_scan_module_name_safe} STREQUAL "DEFAULT
") 755 if (_vtk_scan_WANT_BY_DEFAULT) 756 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "WANT
") 758 set("_vtk_scan_enable_${_vtk_scan_module_name}
" "DONT_WANT
") 760 _vtk_module_debug(enable "@_vtk_scan_module_name@ is DEFAULT,
using `WANT_BY_DEFAULT`: ${_vtk_scan_enable_${_vtk_scan_module_name}}
") 763 list(APPEND _vtk_scan_all_modules 764 "${_vtk_scan_module_name}
") 765 set("_vtk_scan_${_vtk_scan_module_name}_all_depends
" 766 ${${_vtk_scan_module_name}_DEPENDS} 767 ${${_vtk_scan_module_name}_PRIVATE_DEPENDS}) 769 if (${_vtk_scan_module_name}_THIRD_PARTY) 770 set("${_vtk_scan_module_name}_EXCLUDE_WRAP
" TRUE) 771 set("${_vtk_scan_module_name}_IMPLEMENTABLE
" FALSE) 772 set("${_vtk_scan_module_name}_IMPLEMENTS
") 775 if (${_vtk_scan_module_name}_KIT) 776 _vtk_module_debug(kit "@_vtk_scan_module_name@ belongs to the ${${_vtk_scan_module_name}_KIT} kit
") 779 # Set properties for building. 782 "_vtk_module_${_vtk_scan_module_name}_file
" "${_vtk_scan_module_file}
") 785 "_vtk_module_${_vtk_scan_module_name}_namespace
" "${${_vtk_scan_module_name}_NAMESPACE}
") 788 "_vtk_module_${_vtk_scan_module_name}_target_name
" "${${_vtk_scan_module_name}_TARGET_NAME}
") 791 "_vtk_module_${_vtk_scan_module_name}_library_name
" "${${_vtk_scan_module_name}_LIBRARY_NAME}
") 794 "_vtk_module_${_vtk_scan_module_name}_third_party
" "${${_vtk_scan_module_name}_THIRD_PARTY}
") 797 "_vtk_module_${_vtk_scan_module_name}_exclude_wrap
" "${${_vtk_scan_module_name}_EXCLUDE_WRAP}
") 800 "_vtk_module_${_vtk_scan_module_name}_kit
" "${${_vtk_scan_module_name}_KIT}
") 803 "_vtk_module_${_vtk_scan_module_name}_depends
" "${${_vtk_scan_module_name}_DEPENDS}
") 806 "_vtk_module_${_vtk_scan_module_name}_order_depends
" "${${_vtk_scan_module_name}_ORDER_DEPENDS}
") 809 "_vtk_module_${_vtk_scan_module_name}_private_depends
" "${${_vtk_scan_module_name}_PRIVATE_DEPENDS}
") 812 "_vtk_module_${_vtk_scan_module_name}_optional_depends
" "${${_vtk_scan_module_name}_OPTIONAL_DEPENDS}
") 815 "_vtk_module_${_vtk_scan_module_name}_test_depends
" "${${_vtk_scan_module_name}_TEST_DEPENDS}
") 818 "_vtk_module_${_vtk_scan_module_name}_test_optional_depends
" "${${_vtk_scan_module_name}_TEST_OPTIONAL_DEPENDS}
") 821 "_vtk_module_${_vtk_scan_module_name}_test_labels
" "${${_vtk_scan_module_name}_TEST_LABELS}
") 824 "_vtk_module_${_vtk_scan_module_name}_implements
" "${${_vtk_scan_module_name}_IMPLEMENTS}
") 827 "_vtk_module_${_vtk_scan_module_name}_implementable
" "${${_vtk_scan_module_name}_IMPLEMENTABLE}
") 830 set(_vtk_scan_current_modules "${_vtk_scan_all_modules}
") 831 vtk_topological_sort(_vtk_scan_all_modules "_vtk_scan_
" "_all_depends
") 833 set(_vtk_scan_provided_modules) 834 set(_vtk_scan_required_modules) 835 set(_vtk_scan_disabled_modules) 837 # Seed the `_vtk_scan_provide_` variables with modules requested and rejected 839 foreach (_vtk_scan_request_module IN LISTS _vtk_scan_REQUEST_MODULES) 840 set("_vtk_scan_provide_${_vtk_scan_request_module}
" ON) 841 _vtk_module_debug(provide "@_vtk_scan_request_module@ is provided via `REQUEST_MODULES`
") 843 foreach (_vtk_scan_reject_module IN LISTS _vtk_scan_REJECT_MODULES) 844 set("_vtk_scan_provide_${_vtk_scan_reject_module}
" OFF) 845 _vtk_module_debug(provide "@_vtk_scan_reject_module@ is not provided via `REJECT_MODULES`
") 848 # Traverse the graph classifying the quad-state for enabling modules into a 849 # boolean stored in the `_vtk_scan_provide_` variables. 850 foreach (_vtk_scan_module IN LISTS _vtk_scan_all_modules) 851 if (NOT _vtk_scan_module IN_LIST _vtk_scan_current_modules) 852 _vtk_module_debug(provide "@_vtk_scan_module@ is ignored because it is not in the current scan
set") 856 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module}
") 858 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "YES
") 859 # Mark enabled modules as to-be-provided. Any errors with requiring a 860 # disabled module will be dealt with later. 861 set("_vtk_scan_provide_${_vtk_scan_module}
" ON) 862 _vtk_module_debug(provide "@_vtk_scan_module@ is provided due to `YES` setting
") 863 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "WANT
") 864 # Check to see if we can provide this module by checking of any of its 865 # dependencies have been disabled. 866 set(_vtk_scan_test_depends) 867 if (NOT ${_vtk_scan_module}_THIRD_PARTY AND _vtk_scan_ENABLE_TESTS STREQUAL "ON
") 868 # If the tests have to be on, we also need the test dependencies. 869 set(_vtk_scan_test_depends "${${_vtk_scan_module}_TEST_DEPENDS}
") 872 set("_vtk_scan_provide_${_vtk_scan_module}
" ON) 873 _vtk_module_debug(provide "@_vtk_scan_module@ is provided due to `WANT` setting
") 874 foreach (_vtk_scan_module_depend IN LISTS "${_vtk_scan_module}_DEPENDS
" "${_vtk_scan_module}_PRIVATE_DEPENDS
" _vtk_scan_test_depends) 875 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module_depend}
" AND NOT _vtk_scan_provide_${_vtk_scan_module_depend}) 876 set("_vtk_scan_provide_${_vtk_scan_module}
" OFF) 877 _vtk_module_debug(provide "@_vtk_scan_module@ is not provided due to not provided dependency @_vtk_scan_module_depend
@") 881 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "DONT_WANT
") 882 # Check for disabled dependencies and disable if so. 883 foreach (_vtk_scan_module_depend IN LISTS "${_vtk_scan_module}_DEPENDS
" "${_vtk_scan_module}_PRIVATE_DEPENDS
" _vtk_scan_test_depends) 884 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module_depend}
" AND NOT _vtk_scan_provide_${_vtk_scan_module_depend}) 885 set("_vtk_scan_provide_${_vtk_scan_module}
" OFF) 886 _vtk_module_debug(provide "@_vtk_scan_module@ is not provided due to not provided dependency @_vtk_scan_module_depend
@") 890 elseif (_vtk_scan_enable_${_vtk_scan_module} STREQUAL "NO
") 891 # Disable the module. 892 set("_vtk_scan_provide_${_vtk_scan_module}
" OFF) 893 _vtk_module_debug(provide "@_vtk_scan_module@ is not provided due to `NO` setting
") 896 # Collect disabled modules into a list. 897 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module}
" AND NOT _vtk_scan_provide_${_vtk_scan_module}) 898 list(APPEND _vtk_scan_disabled_modules 899 "${_vtk_scan_module}
") 902 if (NOT DEFINED "_vtk_scan_provide_${_vtk_scan_module}
") 903 _vtk_module_debug(provide "@_vtk_scan_module@ is indeterminite (${_vtk_scan_enable_${_vtk_scan_module}})
") 907 # Scan all modules from the top of tree to the bottom. 908 list(REVERSE _vtk_scan_all_modules) 909 foreach (_vtk_scan_module IN LISTS _vtk_scan_all_modules) 910 if (NOT _vtk_scan_module IN_LIST _vtk_scan_current_modules) 914 # If we're providing this module... 915 if (_vtk_scan_provide_${_vtk_scan_module}) 916 list(APPEND _vtk_scan_provided_modules 917 "${_vtk_scan_module}
") 919 # Grab any test dependencies that are required. 920 set(_vtk_scan_test_depends) 921 set(_vtk_scan_test_wants) 922 if (NOT ${_vtk_scan_module}_THIRD_PARTY) 923 if (_vtk_scan_ENABLE_TESTS STREQUAL "ON
") 924 set_property(GLOBAL APPEND 926 "_vtk_module_test_modules
" "${_vtk_scan_module}
") 927 set(_vtk_scan_test_depends "${${_vtk_scan_module}_TEST_DEPENDS}
") 928 elseif (_vtk_scan_ENABLE_TESTS STREQUAL "WANT
") 929 set_property(GLOBAL APPEND 931 "_vtk_module_test_modules
" "${_vtk_scan_module}
") 932 set(_vtk_scan_test_wants _vtk_scan_wants_marker ${${_vtk_scan_module}_TEST_DEPENDS}) 933 elseif (_vtk_scan_ENABLE_TESTS STREQUAL "DEFAULT
") 934 set_property(GLOBAL APPEND 936 "_vtk_module_test_modules
" "${_vtk_scan_module}
") 937 elseif (_vtk_scan_ENABLE_TESTS STREQUAL "OFF
") 941 "Unrecognized option
for ENABLE_TESTS: ${_vtk_module_ENABLE_TESTS}.
") 945 # Add all dependent modules to the list of required or provided modules. 946 set(_vtk_scan_is_wanting 0) 947 foreach (_vtk_scan_module_depend IN LISTS "${_vtk_scan_module}_DEPENDS
" "${_vtk_scan_module}_PRIVATE_DEPENDS
" _vtk_scan_test_depends _vtk_scan_test_wants) 948 if (_vtk_scan_module_depend STREQUAL "_vtk_scan_wants_marker
") 949 set(_vtk_scan_is_wanting 1) 952 # Though we need to error if this would cause a disabled module to be 954 if (_vtk_scan_module_depend IN_LIST _vtk_scan_disabled_modules) 955 if (_vtk_scan_is_wanting) 959 "The ${_vtk_scan_module} module requires the disabled module ${_vtk_scan_module_depend}.
") 963 if (DEFINED "_vtk_scan_provide_${_vtk_scan_module_depend}
") 964 if (NOT _vtk_scan_provide_${_vtk_scan_module_depend}) 966 "The `${_vtk_scan_module_depend} should be provided, but is disabled.
") 970 set("_vtk_scan_provide_${_vtk_scan_module_depend}
" ON) 972 if (NOT _vtk_scan_module_depend IN_LIST _vtk_scan_current_modules) 973 if (NOT TARGET "${_vtk_scan_module_depend}
") 974 _vtk_module_debug(provide "@_vtk_scan_module_depend@ is external and required due to dependency from @_vtk_scan_module
@") 976 list(APPEND _vtk_scan_required_modules 977 "${_vtk_scan_module_depend}
") 979 _vtk_module_debug(provide "@_vtk_scan_module_depend@ is provided due to dependency from @_vtk_scan_module
@") 980 list(APPEND _vtk_scan_provided_modules 981 "${_vtk_scan_module_depend}
") 987 if (_vtk_scan_provided_modules) 988 list(REMOVE_DUPLICATES _vtk_scan_provided_modules) 991 set(_vtk_scan_provided_kits) 993 # Build a list of kits which contain the provided modules. 994 foreach (_vtk_scan_provided_module IN LISTS _vtk_scan_provided_modules) 995 if (${_vtk_scan_provided_module}_KIT) 996 list(APPEND _vtk_scan_provided_kits 997 "${${_vtk_scan_provided_module}_KIT}
") 998 set_property(GLOBAL APPEND 1000 "_vtk_kit_${${_vtk_scan_provided_module}_KIT}_kit_modules
" "${_vtk_scan_provided_module}
") 1004 if (_vtk_scan_provided_kits) 1005 list(REMOVE_DUPLICATES _vtk_scan_provided_kits) 1008 if (_vtk_scan_required_modules) 1009 list(REMOVE_DUPLICATES _vtk_scan_required_modules) 1012 set(_vtk_scan_unrecognized_modules 1013 ${_vtk_scan_REQUEST_MODULES} 1014 ${_vtk_scan_REJECT_MODULES}) 1016 if (_vtk_scan_unrecognized_modules AND (_vtk_scan_provided_modules OR _vtk_scan_rejected_modules)) 1017 list(REMOVE_ITEM _vtk_scan_unrecognized_modules 1018 ${_vtk_scan_provided_modules} 1019 ${_vtk_scan_rejected_modules}) 1022 set("${_vtk_scan_PROVIDES_MODULES}
" 1023 ${_vtk_scan_provided_modules} 1026 if (DEFINED _vtk_scan_REQUIRES_MODULES) 1027 set("${_vtk_scan_REQUIRES_MODULES}
" 1028 ${_vtk_scan_required_modules} 1032 if (DEFINED _vtk_scan_UNRECOGNIZED_MODULES) 1033 set("${_vtk_scan_UNRECOGNIZED_MODULES}
" 1034 ${_vtk_scan_unrecognized_modules} 1038 if (DEFINED _vtk_scan_PROVIDES_KITS) 1039 set("${_vtk_scan_PROVIDES_KITS}
" 1040 ${_vtk_scan_provided_kits} 1046 @page module-overview 1048 @section module-target-functions Module-as-target functions 1050 Due to the nature of VTK modules supporting being built as kits, the module 1051 name might not be usable as a target to CMake's `target_` family of commands. 1052 Instead, there are various wrappers around them which take the module name as 1053 an argument. These handle the forwarding of relevant information to the kit 1054 library as well where necessary. 1056 - @ref vtk_module_set_properties 1057 - @ref vtk_module_set_property 1058 - @ref vtk_module_get_property 1059 - @ref vtk_module_depend 1060 - @ref vtk_module_include 1061 - @ref vtk_module_definitions 1062 - @ref vtk_module_compile_options 1063 - @ref vtk_module_compile_features 1064 - @ref vtk_module_link 1065 - @ref vtk_module_link_options 1069 @page module-internal-api 1071 @section module-target-internals Module target internals 1073 When manipulating modules as targets, there are a few functions provided for 1074 use in wrapping code to more easily access them. 1076 - @ref _vtk_module_real_target 1077 - @ref _vtk_module_real_target_kit 1081 @ingroup module-internal 1082 @brief The real target for a module 1085 _vtk_module_real_target(<var> <module>) 1088 Sometimes the actual, core target for a module is required (e.g., setting 1089 CMake-level target properties or install rules). This function returns the real 1090 target for a module. 1092 function (_vtk_module_real_target var module) 1098 set(_vtk_real_target_res "") 1099 if (TARGET "${module}
") 1100 get_property(_vtk_real_target_imported 1103 if (_vtk_real_target_imported) 1104 set(_vtk_real_target_res "${module}
") 1108 if (NOT _vtk_real_target_res) 1109 get_property(_vtk_real_target_res GLOBAL 1110 PROPERTY "_vtk_module_${module}_target_name
") 1111 # Querying during the build. 1112 if (DEFINED _vtk_build_BUILD_WITH_KITS AND _vtk_build_BUILD_WITH_KITS) 1113 get_property(_vtk_real_target_kit GLOBAL 1114 PROPERTY "_vtk_module_${module}_kit
") 1115 if (_vtk_real_target_kit) 1116 string(APPEND _vtk_real_target_res "-objects
") 1118 # A query for after the module is built. 1119 elseif (TARGET "${_vtk_real_target_res}-objects
") 1120 string(APPEND _vtk_real_target_res "-objects
") 1124 if (NOT _vtk_real_target_res) 1125 set(_vtk_real_target_msg "") 1126 if (NOT TARGET "${module}
") 1127 if (DEFINED _vtk_build_module) 1128 set(_vtk_real_target_msg 1129 " Is a module dependency missing?
") 1131 set(_vtk_real_target_msg 1132 " Is a `find_package` missing a required
component?
") 1136 "Failed to determine the real
target for the `${module}`
" 1137 "module.${_vtk_real_target_msg}
") 1141 "${_vtk_real_target_res}
" 1146 @ingroup module-internal 1147 @brief The real target for a kit 1150 _vtk_module_real_target_kit(<var> <kit>) 1153 Sometimes the actual, core target for a module is required (e.g., setting 1154 CMake-level target properties or install rules). This function returns the real 1157 function (_vtk_module_real_target_kit var kit) 1163 set(_vtk_real_target_res "") 1164 if (TARGET "${kit}
") 1165 get_property(_vtk_real_target_imported 1168 if (_vtk_real_target_imported) 1169 set(_vtk_real_target_res "${kit}
") 1173 if (NOT _vtk_real_target_res) 1174 get_property(_vtk_real_target_res GLOBAL 1175 PROPERTY "_vtk_kit_${kit}_target_name
") 1178 if (NOT _vtk_real_target_res) 1180 "Failed to determine the real
target for the `${kit}` kit.
") 1184 "${_vtk_real_target_res}
" 1190 @brief Set multiple properties on a module 1192 A wrapper around `set_target_properties` that works for modules. 1195 vtk_module_set_properties(<module> 1196 [<property> <value>]...) 1199 function (vtk_module_set_properties module) 1200 _vtk_module_real_target(_vtk_set_properties_target "${module}
") 1202 set_target_properties("${_vtk_set_properties_target}
" 1209 @brief Set a property on a module 1211 A wrapper around `set_property(TARGET)` that works for modules. 1214 vtk_module_set_property(<module> 1215 [APPEND] [APPEND_STRING] 1220 function (vtk_module_set_property module) 1221 cmake_parse_arguments(PARSE_ARGV 1 _vtk_property 1222 "APPEND;APPEND_STRING
" 1226 if (_vtk_property_UNPARSED_ARGUMENTS) 1229 "${_vtk_property_UNPARSED_ARGUMENTS}.
") 1232 if (NOT DEFINED _vtk_property_PROPERTY) 1234 "The `PROPERTY` argument is required.
") 1237 if (NOT DEFINED _vtk_property_VALUE) 1239 "The `VALUE` argument is required.
") 1242 if (_vtk_property_APPEND AND _vtk_property_APPEND_STRING) 1244 "`APPEND` and `APPEND_STRING` may not be used at the same
time.
") 1247 set(_vtk_property_args) 1248 if (_vtk_property_APPEND) 1249 list(APPEND _vtk_property_args 1252 if (_vtk_property_APPEND_STRING) 1253 list(APPEND _vtk_property_args 1257 _vtk_module_real_target(_vtk_property_target "${module}
") 1259 set_property(TARGET "${_vtk_property_target}
" 1260 ${_vtk_property_args} 1262 "${_vtk_property_PROPERTY}
" "${_vtk_property_VALUE}
") 1267 @brief Get a property from a module 1269 A wrapper around `get_property(TARGET)` that works for modules. 1272 vtk_module_get_property(<module> 1274 VARIABLE <variable>) 1277 The variable name passed to the `VARIABLE` argument will be unset if the 1278 property is not set (rather than the empty string). 1280 function (vtk_module_get_property module) 1281 cmake_parse_arguments(PARSE_ARGV 1 _vtk_property 1286 if (_vtk_property_UNPARSED_ARGUMENTS) 1289 "${_vtk_property_UNPARSED_ARGUMENTS}.
") 1292 if (NOT DEFINED _vtk_property_PROPERTY) 1294 "The `PROPERTY` argument is required.
") 1297 if (NOT DEFINED _vtk_property_VARIABLE) 1299 "The `VARIABLE` argument is required.
") 1302 _vtk_module_real_target(_vtk_property_target "${module}
") 1304 get_property(_vtk_property_is_set 1305 TARGET "${_vtk_property_target}
" 1306 PROPERTY "${_vtk_property_PROPERTY}
" 1308 if (_vtk_property_is_set) 1309 get_property(_vtk_property_value 1310 TARGET "${_vtk_property_target}
" 1311 PROPERTY "${_vtk_property_PROPERTY}
") 1313 set("${_vtk_property_VARIABLE}
" 1314 "${_vtk_property_value}
" 1317 unset("${_vtk_property_VARIABLE}
" 1323 @ingroup module-impl 1324 @brief Generate arguments for target function wrappers 1326 Create the `INTERFACE`, `PUBLIC`, and `PRIVATE` arguments for a function 1327 wrapping CMake's `target_` functions to call the wrapped function. 1329 This is necessary because not all of the functions support empty lists given a 1332 function (_vtk_module_target_function prefix) 1333 foreach (visibility IN ITEMS INTERFACE PUBLIC PRIVATE) 1334 if (${prefix}_${visibility}) 1335 set("${prefix}_${visibility}_args
" 1337 ${${prefix}_${visibility}} 1345 @brief Add dependencies to a module 1347 A wrapper around `add_dependencies` that works for modules. 1350 vtk_module_depend(<module> <depend>...) 1353 function (vtk_module_depend module) 1354 _vtk_module_real_target(_vtk_depend_target "${module}
") 1356 add_dependencies("${_vtk_depend_target}
" 1362 @brief Add include directories to a module 1364 A wrapper around `add_dependencies` that works for modules. 1367 vtk_module_include(<module> 1369 [PUBLIC <directory>...] 1370 [PRIVATE <directory>...] 1371 [INTERFACE <directory>...]) 1374 function (vtk_module_include module) 1375 cmake_parse_arguments(PARSE_ARGV 1 _vtk_include 1378 "INTERFACE;PUBLIC;PRIVATE
") 1380 if (_vtk_include_UNPARSED_ARGUMENTS) 1383 "${_vtk_include_UNPARSED_ARGUMENTS}.
") 1386 _vtk_module_real_target(_vtk_include_target "${module}
") 1387 _vtk_module_target_function(_vtk_include) 1389 set(_vtk_include_system_arg) 1390 if (_vtk_include_SYSTEM) 1391 set(_vtk_include_system_arg SYSTEM) 1394 target_include_directories("${_vtk_include_target}
" 1395 ${_vtk_include_system_arg} 1396 ${_vtk_include_INTERFACE_args} 1397 ${_vtk_include_PUBLIC_args} 1398 ${_vtk_include_PRIVATE_args}) 1403 @brief Add compile definitions to a module 1405 A wrapper around `target_compile_definitions` that works for modules. 1408 vtk_module_definitions(<module> 1409 [PUBLIC <directory>...] 1410 [PRIVATE <directory>...] 1411 [INTERFACE <directory>...]) 1414 function (vtk_module_definitions module) 1415 cmake_parse_arguments(PARSE_ARGV 1 _vtk_definitions 1418 "INTERFACE;PUBLIC;PRIVATE
") 1420 if (_vtk_definitions_UNPARSED_ARGUMENTS) 1423 "${_vtk_definitions_UNPARSED_ARGUMENTS}.
") 1426 _vtk_module_real_target(_vtk_definitions_target "${module}
") 1427 _vtk_module_target_function(_vtk_definitions) 1429 target_compile_definitions("${_vtk_definitions_target}
" 1430 ${_vtk_definitions_INTERFACE_args} 1431 ${_vtk_definitions_PUBLIC_args} 1432 ${_vtk_definitions_PRIVATE_args}) 1437 @brief Add compile options to a module 1439 A wrapper around `target_compile_options` that works for modules. 1442 vtk_module_compile_options(<module> 1443 [PUBLIC <directory>...] 1444 [PRIVATE <directory>...] 1445 [INTERFACE <directory>...]) 1448 function (vtk_module_compile_options module) 1449 cmake_parse_arguments(PARSE_ARGV 1 _vtk_compile_options 1452 "INTERFACE;PUBLIC;PRIVATE
") 1454 if (_vtk_compile_options_UNPARSED_ARGUMENTS) 1457 "${_vtk_compile_options_UNPARSED_ARGUMENTS}.
") 1460 _vtk_module_real_target(_vtk_compile_options_target "${module}
") 1461 _vtk_module_target_function(_vtk_compile_options) 1463 target_compile_options("${_vtk_compile_options_target}
" 1464 ${_vtk_compile_options_INTERFACE_args} 1465 ${_vtk_compile_options_PUBLIC_args} 1466 ${_vtk_compile_options_PRIVATE_args}) 1471 @brief Add compile features to a module 1473 A wrapper around `target_compile_features` that works for modules. 1476 vtk_module_compile_features(<module> 1477 [PUBLIC <directory>...] 1478 [PRIVATE <directory>...] 1479 [INTERFACE <directory>...]) 1482 function (vtk_module_compile_features module) 1483 cmake_parse_arguments(PARSE_ARGV 1 _vtk_compile_features 1486 "INTERFACE;PUBLIC;PRIVATE
") 1488 if (_vtk_compile_features_UNPARSED_ARGUMENTS) 1491 "${_vtk_compile_features_UNPARSED_ARGUMENTS}.
") 1494 _vtk_module_real_target(_vtk_compile_features_target "${module}
") 1495 _vtk_module_target_function(_vtk_compile_features) 1497 target_compile_features("${_vtk_compile_features_target}
" 1498 ${_vtk_compile_features_INTERFACE_args} 1499 ${_vtk_compile_features_PUBLIC_args} 1500 ${_vtk_compile_features_PRIVATE_args}) 1504 @ingroup module-impl 1505 @brief Manage the private link target for a module 1507 This function manages the private link target for a module. 1510 _vtk_private_kit_link_target(<module> 1512 [SETUP_TARGET_NAME <var>] 1513 [USAGE_TARGET_NAME <var>]) 1516 function (_vtk_private_kit_link_target module) 1517 cmake_parse_arguments(_vtk_private_kit_link_target 1519 "SETUP_TARGET_NAME;USAGE_TARGET_NAME
" 1523 if (_vtk_private_kit_link_target_UNPARSED_ARGUMENTS) 1526 "${_vtk_private_kit_link_target_UNPARSED_ARGUMENTS}.
") 1529 # Compute the target name. 1530 get_property(_vtk_private_kit_link_base_target_name GLOBAL 1531 PROPERTY "_vtk_module_${module}_target_name
") 1532 if (NOT _vtk_private_kit_link_base_target_name) 1538 set(_vtk_private_kit_link_target_setup_name 1539 "${_vtk_private_kit_link_base_target_name}-
private-kit-links
") 1540 get_property(_vtk_private_kit_link_namespace GLOBAL 1541 PROPERTY "_vtk_module_${module}_namespace
") 1542 if (_vtk_private_kit_link_namespace) 1543 set(_vtk_private_kit_link_target_usage_name 1544 "${_vtk_private_kit_link_namespace}::${_vtk_private_kit_link_target_setup_name}
") 1546 set(_vtk_private_kit_link_target_usage_name 1547 ":${_vtk_private_kit_link_target_setup_name}
") 1550 # Create the target if requested. 1551 if (_vtk_private_kit_link_target_CREATE_IF_NEEDED AND 1552 NOT TARGET "${_vtk_private_kit_link_target_setup_name}
") 1553 add_library("${_vtk_private_kit_link_target_setup_name}
" INTERFACE) 1554 if (NOT _vtk_private_kit_link_target_setup_name STREQUAL _vtk_private_kit_link_target_usage_name) 1555 add_library("${_vtk_private_kit_link_target_usage_name}
" ALIAS 1556 "${_vtk_private_kit_link_target_setup_name}
") 1558 _vtk_module_install("${_vtk_private_kit_link_target_setup_name}
") 1561 if (_vtk_private_kit_link_target_SETUP_TARGET_NAME) 1562 set("${_vtk_private_kit_link_target_SETUP_TARGET_NAME}
" 1563 "${_vtk_private_kit_link_target_setup_name}
" 1567 if (_vtk_private_kit_link_target_USAGE_TARGET_NAME) 1568 set("${_vtk_private_kit_link_target_USAGE_TARGET_NAME}
" 1569 "${_vtk_private_kit_link_target_usage_name}
" 1576 @brief Add link libraries to a module 1578 A wrapper around `target_link_libraries` that works for modules. Note that this 1579 function does extra work in kit builds, so circumventing it may break in kit 1583 vtk_module_link(<module> 1584 [PUBLIC <directory>...] 1585 [PRIVATE <directory>...] 1586 [INTERFACE <directory>...]) 1589 function (vtk_module_link module) 1590 cmake_parse_arguments(PARSE_ARGV 1 _vtk_link 1593 "INTERFACE;PUBLIC;PRIVATE
") 1595 if (_vtk_link_UNPARSED_ARGUMENTS) 1598 "${_vtk_link_UNPARSED_ARGUMENTS}.
") 1601 _vtk_module_real_target(_vtk_link_target "${module}
") 1602 _vtk_module_target_function(_vtk_link) 1604 get_property(_vtk_link_kit GLOBAL 1605 PROPERTY "_vtk_module_${module}_kit
") 1607 if (_vtk_link_PRIVATE) 1608 _vtk_private_kit_link_target("${module}
" 1610 SETUP_TARGET_NAME _vtk_link_private_kit_link_target) 1611 foreach (_vtk_link_private IN LISTS _vtk_link_PRIVATE) 1612 target_link_libraries("${_vtk_link_private_kit_link_target}
" 1614 "$<LINK_ONLY:${_vtk_link_private}>
") 1619 target_link_libraries("${_vtk_link_target}
" 1620 ${_vtk_link_INTERFACE_args} 1621 ${_vtk_link_PUBLIC_args} 1622 ${_vtk_link_PRIVATE_args}) 1627 @brief Add link options to a module 1629 A wrapper around `target_link_options` that works for modules. 1632 vtk_module_link_options(<module> 1633 [PUBLIC <directory>...] 1634 [PRIVATE <directory>...] 1635 [INTERFACE <directory>...]) 1638 function (vtk_module_link_options module) 1639 cmake_parse_arguments(PARSE_ARGV 1 _vtk_link_options 1642 "INTERFACE;PUBLIC;PRIVATE
") 1644 if (_vtk_link_options_UNPARSED_ARGUMENTS) 1647 "${_vtk_link_options_UNPARSED_ARGUMENTS}.
") 1650 _vtk_module_real_target(_vtk_link_options_target "${module}
") 1651 _vtk_module_target_function(_vtk_link_options) 1653 target_link_options("${_vtk_link_options_target}
" 1654 ${_vtk_link_options_INTERFACE_args} 1655 ${_vtk_link_options_PUBLIC_args} 1656 ${_vtk_link_options_PRIVATE_args}) 1660 @page module-internal-api 1662 @ingroup module-internal 1663 @section module-properties Module properties 1665 The VTK module system leverages CMake's target propagation and storage. As 1666 such, there are a number of properties added to the targets representing 1667 modules. These properties are intended for use by the module system and 1668 associated functionality. In particular, more properties may be available by 1671 @subsection module-properties-naming Naming properties 1673 When creating properties for use with the module system, they should be 1674 prefixed with `INTERFACE_vtk_module_`. The `INTERFACE_` portion is required in 1675 order to work with interface libraries. The `vtk_module_` portion is to avoid 1676 colliding with any other properties. This function assumes this naming scheme 1677 for some of its convenience features as well. 1679 Properties should be the same in the local build as well as when imported to 1682 @subsection module-properties-system VTK module system properties 1684 There are a number of properties that are used and expected by the core of the 1685 module system. These are generally module metadata (module dependencies, 1686 whether to wrap or not, etc.). The properties all have the 1687 `INTERFACE_vtk_module_` prefix mentioned in the previous section. 1689 * `third_party`: If set, the module represents a third party 1690 dependency and should be treated specially. Third party modules are very 1691 restricted and generally do not have any other properties set on them. 1692 * `exclude_wrap`: If set, the module should not be wrapped by an external 1694 * `depends`: The list of dependent modules. Language wrappers will generally 1695 require this to satisfy references to parent classes of the classes in the 1697 * `private_depends`: The list of privately dependent modules. Language 1698 wrappers may require this to satisfy references to parent classes of the 1699 classes in the module. 1700 * `optional_depends`: The list of optionally dependent modules. Language 1701 wrappers may require this to satisfy references to parent classes of the 1702 classes in the module. 1703 * `kit`: The kit the module is a member of. Only set if the module is 1704 actually a member of the kit (i.e., the module was built with 1705 `BUILD_WITH_KITS ON`). 1706 * `implements`: The list of modules for which this module registers to. This 1707 is used by the autoinit subsystem and generally is not required. 1708 * `implementable`: If set, this module provides registries which may be 1709 populated by dependent modules. It is used to check the `implements` 1710 property to help minimize unnecessary work from the autoinit subsystem. 1711 * `needs_autoinit`: If set, linking to this module requires the autoinit 1712 subsystem to ensure that registries in modules are fully populated. 1713 * `headers`: Paths to the public headers from the module. These are the 1714 headers which should be handled by language wrappers. 1715 * `hierarchy`: The path to the hierarchy file describing inheritance of the 1716 classes for use in language wrappers. 1717 * `forward_link`: Usage requirements that must be forwarded even though the 1718 module is linked to privately. 1720 Kits have the following properties available (but only if kits are enabled): 1722 * `kit_modules`: Modules which are compiled into the kit. 1726 @ingroup module-internal 1727 @brief Set a module property 1729 This function sets a [module property](@ref module-properties) on a module. The 1730 required prefix will automatically be added to the passed name. 1733 _vtk_module_set_module_property(<module> 1734 [APPEND] [APPEND_STRING] 1739 function (_vtk_module_set_module_property module) 1740 cmake_parse_arguments(PARSE_ARGV 1 _vtk_property 1741 "APPEND;APPEND_STRING
" 1745 if (_vtk_property_UNPARSED_ARGUMENTS) 1747 "Unparsed arguments
for vtk_module_set_module_property:
" 1748 "${_vtk_property_UNPARSED_ARGUMENTS}.
") 1751 if (NOT DEFINED _vtk_property_PROPERTY) 1753 "The `PROPERTY` argument is required.
") 1756 if (NOT DEFINED _vtk_property_VALUE) 1758 "The `VALUE` argument is required.
") 1761 if (_vtk_property_APPEND AND _vtk_property_APPEND_STRING) 1763 "`APPEND` and `APPEND_STRING` may not be used at the same
time.
") 1766 set(_vtk_property_args) 1767 if (_vtk_property_APPEND) 1768 list(APPEND _vtk_property_args 1771 if (_vtk_property_APPEND_STRING) 1772 list(APPEND _vtk_property_args 1776 get_property(_vtk_property_is_alias 1778 PROPERTY ALIASED_TARGET 1780 if (_vtk_property_is_alias) 1781 _vtk_module_real_target(_vtk_property_target "${module}
") 1783 set(_vtk_property_target "${module}
") 1786 set_property(TARGET "${_vtk_property_target}
" 1787 ${_vtk_property_args} 1789 "INTERFACE_vtk_module_${_vtk_property_PROPERTY}
" "${_vtk_property_VALUE}
") 1793 @ingroup module-internal 1794 @brief Get a module property 1796 Get a [module property](@ref module-properties) from a module. 1799 _vtk_module_get_module_property(<module> 1801 VARIABLE <variable>) 1804 As with @ref vtk_module_get_property, the output variable will be unset if the 1805 property is not set. The property name is automatically prepended with the 1808 function (_vtk_module_get_module_property module) 1809 cmake_parse_arguments(PARSE_ARGV 1 _vtk_property 1814 if (_vtk_property_UNPARSED_ARGUMENTS) 1816 "Unparsed arguments
for vtk_module_get_module_property:
" 1817 "${_vtk_property_UNPARSED_ARGUMENTS}.
") 1820 if (NOT DEFINED _vtk_property_PROPERTY) 1822 "The `PROPERTY` argument is required.
") 1825 if (NOT DEFINED _vtk_property_VARIABLE) 1827 "The `VARIABLE` argument is required.
") 1830 get_property(_vtk_property_is_alias 1832 PROPERTY ALIASED_TARGET 1834 if (_vtk_property_is_alias) 1835 _vtk_module_real_target(_vtk_property_target "${module}
") 1837 set(_vtk_property_target "${module}
") 1840 get_property(_vtk_property_is_set 1841 TARGET "${_vtk_property_target}
" 1842 PROPERTY "INTERFACE_vtk_module_${_vtk_property_PROPERTY}
" 1844 if (_vtk_property_is_set) 1845 get_property(_vtk_property_value 1846 TARGET "${_vtk_property_target}
" 1847 PROPERTY "INTERFACE_vtk_module_${_vtk_property_PROPERTY}
") 1849 set("${_vtk_property_VARIABLE}
" 1850 "${_vtk_property_value}
" 1853 unset("${_vtk_property_VARIABLE}
" 1859 @ingroup module-internal 1860 @brief Check that destinations are valid 1862 All installation destinations are expected to be relative so that 1863 `CMAKE_INSTALL_PREFIX` can be relied upon in all code paths. This function may 1864 be used to verify that destinations are relative. 1867 _vtk_module_check_destinations(<prefix> [<suffix>...]) 1870 For each `suffix`, `prefix` is prefixed to it and the resulting variable name 1871 is checked for validity as an install prefix. Raises an error if any is 1874 function (_vtk_module_check_destinations prefix) 1875 foreach (suffix IN LISTS ARGN) 1876 if (IS_ABSOLUTE "${${prefix}${suffix}}
") 1878 "The `${suffix}` must not be an absolute path. Use
" 1879 "`CMAKE_INSTALL_PREFIX` to keep everything in a single installation
" 1886 @ingroup module-internal 1887 @brief Write an import prefix statement 1889 CMake files, once installed, may need to construct paths to other locations 1890 within the install prefix. This function writes a prefix computation for file 1891 given its install destination. 1894 _vtk_module_write_import_prefix(<file> <destination>) 1897 The passed file is cleared so that it occurs at the top of the file. The prefix 1898 is available in the file as the `_vtk_module_import_prefix` variable. It is 1899 recommended to unset the variable at the end of the file. 1901 function (_vtk_module_write_import_prefix file destination) 1902 if (IS_ABSOLUTE "${destination}
") 1904 "An
import prefix cannot be determined from an absolute installation
" 1905 "destination. Use `CMAKE_INSTALL_PREFIX` to keep everything in a single
" 1906 "installation prefix.
") 1909 file(WRITE "${file}
" 1910 "set(_vtk_module_import_prefix \
"\${CMAKE_CURRENT_LIST_DIR}\")\n")
1912 get_filename_component(destination
"${destination}" DIRECTORY)
1913 file(APPEND
"${file}" 1914 "get_filename_component(_vtk_module_import_prefix \"\${_vtk_module_import_prefix}\" DIRECTORY)\n")
1919 @ingroup module-
internal 1920 @brief Export properties
on modules and targets
1922 This
function is intended
for use in support functions which leverage the
1923 module system, not by general system users. This
function supports exporting
1924 properties from the build into dependencies via
target properties which are
1925 loaded from a project
's config file which is loaded via CMake's `find_package`
1934 [PROPERTIES <property>...]
1935 [FROM_GLOBAL_PROPERTIES <property fragment>...]
1936 [SPLIT_INSTALL_PROPERTIES <property fragment>...])
1939 The `BUILD_FILE` and `INSTALL_FILE` arguments are required. Exactly one of
1940 `MODULE` and `KIT` is also required. The `MODULE` or `KIT` argument holds the
1941 name of the module or kit that will have properties exported. The `BUILD_FILE`
1942 and `INSTALL_FILE` paths are *appended to*. As such, when setting up these
1943 files, it should be preceded with:
1946 file(WRITE
"${build_file}")
1947 file(WRITE
"${install_file}")
1950 To avoid accidental usage of the install file from the build tree, it is
1951 recommended to store it under a `CMakeFiles/` directory in the build tree with
1952 an additional `.install` suffix and use `install(RENAME)` to rename it at
1955 The
set of properties exported is computed as follows:
1957 * `PROPERTIES` queries the module
target for the given
property and exports
1958 its
value as-is to both the build and install files. In addition, these
1959 properties are
set on the
target directly as the same
name.
1960 * `FROM_GLOBAL_PROPERTIES` queries the global
1961 `_vtk_module_<MODULE>_<fragment>`
property and exports it to both the build
1962 and install files as `INTERFACE_vtk_module_<fragment>`.
1963 * `SPLIT_INSTALL_PROPERTIES` queries the
target for 1964 `INTERFACE_vtk_module_<fragment>` and exports its
value to the build file
1965 and `INTERFACE_vtk_module_<fragment>_install` to the install file as the
1966 non-install
property name. This is generally useful
for properties which
1967 change between the build and installation.
1970 cmake_parse_arguments(PARSE_ARGV 0 _vtk_export_properties
1972 "BUILD_FILE;INSTALL_FILE;MODULE;KIT" 1973 "FROM_GLOBAL_PROPERTIES;PROPERTIES;SPLIT_INSTALL_PROPERTIES")
1975 if (_vtk_export_properties_UNPARSED_ARGUMENTS)
1977 "Unparsed arguments for _vtk_export_properties: " 1978 "${_vtk_export_properties_UNPARSED_ARGUMENTS}.")
1981 if (DEFINED _vtk_export_properties_MODULE)
1982 if (DEFINED _vtk_export_properties_KIT)
1984 "Only one of `MODULE` or `KIT` is required to export properties.")
1986 set(_vtk_export_properties_type "module")
1987 set(_vtk_export_properties_name "${_vtk_export_properties_MODULE}
") 1988 elseif (_vtk_export_properties_KIT) 1989 set(_vtk_export_properties_type "kit
") 1990 set(_vtk_export_properties_name "${_vtk_export_properties_KIT}
") 1993 "A module or kit is required to export properties.
") 1996 if (NOT _vtk_export_properties_BUILD_FILE) 1998 "Exporting properties requires a build file to write to.
") 2001 if (NOT _vtk_export_properties_INSTALL_FILE) 2003 "Exporting properties requires an install file to write to.
") 2006 if (_vtk_export_properties_type STREQUAL "module
") 2007 _vtk_module_real_target(_vtk_export_properties_target_name "${_vtk_export_properties_name}
") 2008 elseif (_vtk_export_properties_type STREQUAL "kit
") 2009 _vtk_module_real_target_kit(_vtk_export_properties_target_name "${_vtk_export_properties_name}
") 2012 foreach (_vtk_export_properties_global IN LISTS _vtk_export_properties_FROM_GLOBAL_PROPERTIES) 2013 get_property(_vtk_export_properties_is_set GLOBAL 2014 PROPERTY "_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_name}_${_vtk_export_properties_global}
" 2016 if (NOT _vtk_export_properties_is_set) 2020 get_property(_vtk_export_properties_value GLOBAL 2021 PROPERTY "_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_name}_${_vtk_export_properties_global}
") 2022 set(_vtk_export_properties_set_property 2023 "set_property(TARGET \
"${_vtk_export_properties_name}\" PROPERTY \"INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_global}\" \"${_vtk_export_properties_value}\")\n")
2025 set_property(TARGET
"${_vtk_export_properties_target_name}" 2027 "INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_global}" "${_vtk_export_properties_value}")
2028 file(APPEND
"${_vtk_export_properties_BUILD_FILE}" 2029 "${_vtk_export_properties_set_property}")
2030 file(APPEND
"${_vtk_export_properties_INSTALL_FILE}" 2031 "${_vtk_export_properties_set_property}")
2034 foreach (_vtk_export_properties_target IN LISTS _vtk_export_properties_PROPERTIES)
2035 get_property(_vtk_export_properties_is_set
2036 TARGET
"${_vtk_export_properties_target_name}" 2037 PROPERTY
"${_vtk_export_properties_target}" 2039 if (NOT _vtk_export_properties_is_set)
2043 get_property(_vtk_export_properties_value
2044 TARGET
"${_vtk_export_properties_target_name}" 2045 PROPERTY
"${_vtk_export_properties_target}")
2046 set(_vtk_export_properties_set_property
2047 "set_property(TARGET \"${_vtk_export_properties_name}\" PROPERTY \"${_vtk_export_properties_target}\" \"${_vtk_export_properties_value}\")\n")
2049 file(APPEND
"${_vtk_export_properties_BUILD_FILE}" 2050 "${_vtk_export_properties_set_property}")
2051 file(APPEND
"${_vtk_export_properties_INSTALL_FILE}" 2052 "${_vtk_export_properties_set_property}")
2055 foreach (_vtk_export_properties_split IN LISTS _vtk_export_properties_SPLIT_INSTALL_PROPERTIES)
2056 get_property(_vtk_export_properties_is_set
2057 TARGET
"${_vtk_export_properties_target_name}" 2058 PROPERTY
"INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_split}" 2060 if (NOT _vtk_export_properties_is_set)
2064 get_property(_vtk_export_properties_value
2065 TARGET
"${_vtk_export_properties_target_name}" 2066 PROPERTY
"INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_split}")
2067 set(_vtk_export_properties_set_property
2068 "set_property(TARGET \"${_vtk_export_properties_name}\" PROPERTY \"INTERFACE_vtk_module_${_vtk_export_properties_split}\" \"${_vtk_export_properties_value}\")\n")
2069 file(APPEND
"${_vtk_export_properties_BUILD_FILE}" 2070 "${_vtk_export_properties_set_property}")
2072 get_property(_vtk_export_properties_value
2073 TARGET
"${_vtk_export_properties_target_name}" 2074 PROPERTY
"INTERFACE_vtk_${_vtk_export_properties_type}_${_vtk_export_properties_split}_install")
2075 set(_vtk_export_properties_set_property
2076 "set_property(TARGET \"${_vtk_export_properties_name}\" PROPERTY \"INTERFACE_vtk_module_${_vtk_export_properties_split}\" \"${_vtk_export_properties_value}\")\n")
2077 file(APPEND
"${_vtk_export_properties_INSTALL_FILE}" 2078 "${_vtk_export_properties_set_property}")
2082 include(
"${CMAKE_CURRENT_LIST_DIR}/vtkModuleTesting.cmake")
2086 @brief Build modules and kits
2088 Once all of the modules have been scanned, they need to be built. Generally,
2089 there will be just one build necessary
for a
set of scans, though they may be
2090 built distinctly as well. If there are multiple calls to
this function, they
2091 should generally in reverse
order of their scans.
2098 [LIBRARY_NAME_SUFFIX <suffix>]
2100 [SOVERSION <soversion>]
2104 [BUILD_WITH_KITS <ON|OFF>]
2106 [ENABLE_WRAPPING <ON|OFF>]
2108 [USE_EXTERNAL <ON|OFF>]
2110 [INSTALL_HEADERS <ON|OFF>]
2111 [HEADERS_COMPONENT <component>]
2113 [TARGETS_COMPONENT <component>]
2114 [INSTALL_EXPORT <export>]
2116 [TARGET_SPECIFIC_COMPONENTS <ON|OFF>]
2118 [TEST_DIRECTORY_NAME <name>]
2119 [TEST_DATA_TARGET <target>]
2120 [TEST_INPUT_DATA_DIRECTORY <directory>]
2121 [TEST_OUTPUT_DATA_DIRECTORY <directory>]
2122 [TEST_OUTPUT_DIRECTORY <directory>]
2124 [ARCHIVE_DESTINATION <destination>]
2125 [HEADERS_DESTINATION <destination>]
2126 [LIBRARY_DESTINATION <destination>]
2127 [RUNTIME_DESTINATION <destination>]
2128 [CMAKE_DESTINATION <destination>]
2129 [LICENSE_DESTINATION <destination>]
2130 [HIERARCHY_DESTINATION <destination>])
2133 The only requirement of the
function is the list of modules to build, the rest
2134 have reasonable defaults
if not specified.
2136 * `MODULES`: (Required) The list of modules to build.
2137 * `KITS`: (Required
if `BUILD_WITH_KITS` is `ON`) The list of kits to build.
2138 * `LIBRARY_NAME_SUFFIX`: (Defaults to `
""`) A suffix to add to library names.
2139 If it is not empty, it is prefixed with `-` to separate it from the kit
2141 * `
VERSION`: If specified, the `
VERSION` property
on built libraries will be
2143 * `SOVERSION`: If specified, the `SOVERSION` property
on built libraries will
2144 be
set to
this value.
2145 * `
PACKAGE`: (Defaults to `${CMAKE_PROJECT_NAME}`) The
name the build is
2146 meant to be found as when
using `find_package`. Note that separate builds
2147 will require distinct `
PACKAGE` values.
2148 * `BUILD_WITH_KITS`: (Defaults to `OFF`) If
enabled, kit libraries will be
2150 * `ENABLE_WRAPPING`: (Default depends
on the existence of
2151 `VTK::WrapHierarchy` or `VTKCompileTools::WrapHierarchy` targets) If
2152 enabled, wrapping will be available to the modules built in
this call.
2153 * `USE_EXTERNAL`: (Defaults to `OFF`) Whether third party modules should find
2154 external copies rather than building their own copy.
2155 * `INSTALL_HEADERS`: (Defaults to `ON`) Whether or not to install
public headers.
2156 * `HEADERS_COMPONENT`: (Defaults to `development`) The install
component to
2157 use
for header installation. Note that other SDK-related bits use the same
2159 * `TARGETS_COMPONENT`: `Defaults to `runtime`) The install
component to use
2160 for the libraries built.
2161 * `TARGET_SPECIFIC_COMPONENTS`: (Defaults to `OFF`) If `ON`, place artifacts
2162 into
target-specific install components (`<TARGET>-<COMPONENT>`).
2163 * `TARGET_NAMESPACE`: `Defaults to `\<AUTO\>`) The
namespace for installed
2164 targets. All targets must have the same
namespace. If
set to `\<AUTO\>`,
2165 the
namespace will be detected automatically.
2166 * `INSTALL_EXPORT`: (Defaults to `
""`) If non-empty, targets will be added to
2167 the given export. The export will also be installed as part of
this build
2169 * `TEST_DIRECTORY_NAME`: (Defaults to `Testing`) The
name of the testing
2170 directory to look
for in each module. Set to `
NONE` to disable automatic
2173 testing
data download commands to.
2174 * `TEST_INPUT_DATA_DIRECTORY`: (Defaults to
2175 `${CMAKE_CURRENT_SOURCE_DIR}/Data`) The directory which will contain
data 2177 * `TEST_OUTPUT_DATA_DIRECTORY`: (Defaults to
2178 `${CMAKE_CURRENT_BINARY_DIR}/Data`) The directory which will contain
data 2180 * `TEST_OUTPUT_DIRECTORY`: (Defaults to
2181 `${CMAKE_BINARY_DIR}/<TEST_DIRECTORY_NAME>/Temporary`) The directory which
2182 tests may write any output files to.
2184 The remaining arguments control where to install files related to the build.
2185 See CMake
documentation for the difference between `ARCHIVE`, `LIBRARY`, and
2188 * `ARCHIVE_DESTINATION`: (Defaults to `${CMAKE_INSTALL_LIBDIR}`) The install
2189 destination
for archive files.
2190 * `HEADERS_DESTINATION`: (Defaults to `${CMAKE_INSTALL_INCLUDEDIR}`) The
2191 install destination
for header files.
2192 * `LIBRARY_DESTINATION`: (Defaults to `${CMAKE_INSTALL_LIBDIR}`) The install
2193 destination
for library files.
2194 * `RUNTIME_DESTINATION`: (Defaults to `${CMAKE_INSTALL_BINDIR}`) The install
2195 destination
for runtime files.
2196 * `CMAKE_DESTINATION`: (Defaults to `<library destination>/cmake/<package>`)
2197 The install destination
for CMake files.
2198 * `LICENSE_DESTINATION`: (Defaults to `${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}`)
2199 The install destination
for license files (relevant
for third party
2201 * `HIERARCHY_DESTINATION`: (Defaults to `<library
2202 destination>/
vtk/hierarchy/<
PACKAGE>`) The install destination
2203 for hierarchy files (used
for language wrapping).
2206 set(_vtk_build_install_arguments
2223 HIERARCHY_DESTINATION)
2224 set(_vtk_build_test_arguments
2228 TEST_INPUT_DATA_DIRECTORY
2229 TEST_OUTPUT_DATA_DIRECTORY
2230 TEST_OUTPUT_DIRECTORY)
2235 cmake_parse_arguments(PARSE_ARGV 0 _vtk_build
2237 "BUILD_WITH_KITS;USE_EXTERNAL;TARGET_SPECIFIC_COMPONENTS;LIBRARY_NAME_SUFFIX;VERSION;SOVERSION;PACKAGE;ENABLE_WRAPPING;${_vtk_build_install_arguments};${_vtk_build_test_arguments}" 2240 if (_vtk_build_UNPARSED_ARGUMENTS)
2242 "Unparsed arguments for vtk_module_build: " 2243 "${_vtk_build_UNPARSED_ARGUMENTS}")
2246 if (NOT DEFINED _vtk_build_USE_EXTERNAL)
2247 set(_vtk_build_USE_EXTERNAL OFF)
2250 if (NOT DEFINED _vtk_build_TARGET_SPECIFIC_COMPONENTS)
2251 set(_vtk_build_TARGET_SPECIFIC_COMPONENTS OFF)
2254 if (NOT DEFINED _vtk_build_PACKAGE)
2255 set(_vtk_build_PACKAGE "${CMAKE_PROJECT_NAME}
") 2257 get_property(_vtk_build_package_exists GLOBAL 2258 PROPERTY "_vtk_module_package_${_vtk_build_PACKAGE}
" 2260 if (_vtk_build_package_exists) 2262 "A
set of modules have already been built
using the
" 2263 "`${_vtk_build_PACKAGE}` package.
") 2267 "_vtk_module_package_${_vtk_build_PACKAGE}
" "ON
") 2270 if (NOT DEFINED _vtk_build_INSTALL_HEADERS) 2271 set(_vtk_build_INSTALL_HEADERS ON) 2274 if (NOT DEFINED _vtk_build_ENABLE_WRAPPING) 2275 if (TARGET "VTKCompileTools::WrapHierarchy
" OR 2276 TARGET "VTK::WrapHierarchy
") 2277 set(_vtk_build_ENABLE_WRAPPING ON) 2279 set(_vtk_build_ENABLE_WRAPPING OFF) 2283 if (NOT DEFINED _vtk_build_TARGET_NAMESPACE) 2284 set(_vtk_build_TARGET_NAMESPACE "<AUTO>
") 2287 if (NOT DEFINED _vtk_build_BUILD_WITH_KITS) 2288 set(_vtk_build_BUILD_WITH_KITS OFF) 2291 if (_vtk_build_BUILD_WITH_KITS AND NOT DEFINED _vtk_build_KITS) 2293 "Building with kits was requested, but no kits were specified.
") 2296 if (NOT DEFINED _vtk_build_TEST_DIRECTORY_NAME) 2297 set(_vtk_build_TEST_DIRECTORY_NAME "Testing
") 2300 if (NOT DEFINED _vtk_build_TEST_DATA_TARGET) 2301 set(_vtk_build_TEST_DATA_TARGET "${_vtk_build_PACKAGE}-
data") 2304 if (NOT DEFINED _vtk_build_TEST_INPUT_DATA_DIRECTORY) 2305 set(_vtk_build_TEST_INPUT_DATA_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/Data
") 2308 if (NOT DEFINED _vtk_build_TEST_OUTPUT_DATA_DIRECTORY) 2309 set(_vtk_build_TEST_OUTPUT_DATA_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Data
") 2312 if (NOT DEFINED _vtk_build_TEST_OUTPUT_DIRECTORY) 2313 set(_vtk_build_TEST_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_vtk_build_TEST_DIRECTORY_NAME}/Temporary
") 2316 if (NOT DEFINED _vtk_build_HEADERS_COMPONENT) 2317 set(_vtk_build_HEADERS_COMPONENT "development
") 2320 if (NOT DEFINED _vtk_build_ARCHIVE_DESTINATION) 2321 set(_vtk_build_ARCHIVE_DESTINATION "${CMAKE_INSTALL_LIBDIR}
") 2324 if (NOT DEFINED _vtk_build_HEADERS_DESTINATION) 2325 set(_vtk_build_HEADERS_DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}
") 2328 if (NOT DEFINED _vtk_build_LIBRARY_DESTINATION) 2329 set(_vtk_build_LIBRARY_DESTINATION "${CMAKE_INSTALL_LIBDIR}
") 2332 if (NOT DEFINED _vtk_build_RUNTIME_DESTINATION) 2333 set(_vtk_build_RUNTIME_DESTINATION "${CMAKE_INSTALL_BINDIR}
") 2336 if (NOT DEFINED _vtk_build_CMAKE_DESTINATION) 2337 set(_vtk_build_CMAKE_DESTINATION "${_vtk_build_LIBRARY_DESTINATION}/cmake/${_vtk_build_PACKAGE}
") 2340 if (NOT DEFINED _vtk_build_LICENSE_DESTINATION) 2341 set(_vtk_build_LICENSE_DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/licenses/${CMAKE_PROJECT_NAME}
") 2344 if (NOT DEFINED _vtk_build_HIERARCHY_DESTINATION) 2345 set(_vtk_build_HIERARCHY_DESTINATION "${_vtk_build_LIBRARY_DESTINATION}/
vtk/hierarchy/${_vtk_build_PACKAGE}
") 2348 if (NOT DEFINED _vtk_build_TARGETS_COMPONENT) 2349 set(_vtk_build_TARGETS_COMPONENT "runtime
") 2352 if (NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) 2353 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_vtk_build_ARCHIVE_DESTINATION}
") 2355 if (NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) 2356 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_vtk_build_LIBRARY_DESTINATION}
") 2358 if (NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) 2359 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${_vtk_build_RUNTIME_DESTINATION}
") 2362 if (NOT _vtk_build_MODULES) 2364 "No modules given to build.
") 2367 _vtk_module_check_destinations(_vtk_build_ 2373 HIERARCHY_DESTINATION) 2375 foreach (_vtk_build_module IN LISTS _vtk_build_MODULES) 2376 get_property("_vtk_build_${_vtk_build_module}_depends
" GLOBAL 2377 PROPERTY "_vtk_module_${_vtk_build_module}_depends
") 2378 get_property("_vtk_build_${_vtk_build_module}_private_depends
" GLOBAL 2379 PROPERTY "_vtk_module_${_vtk_build_module}_private_depends
") 2380 get_property("_vtk_build_${_vtk_build_module}_optional_depends
" GLOBAL 2381 PROPERTY "_vtk_module_${_vtk_build_module}_optional_depends
") 2382 get_property("_vtk_build_${_vtk_build_module}_order_depends
" GLOBAL 2383 PROPERTY "_vtk_module_${_vtk_build_module}_order_depends
") 2384 set("_vtk_build_${_vtk_build_module}_all_depends
" 2385 ${_vtk_build_${_vtk_build_module}_depends} 2386 ${_vtk_build_${_vtk_build_module}_private_depends} 2387 ${_vtk_build_${_vtk_build_module}_optional_depends} 2388 ${_vtk_build_${_vtk_build_module}_order_depends}) 2391 set(_vtk_build_sorted_modules "${_vtk_build_MODULES}
") 2392 vtk_topological_sort(_vtk_build_sorted_modules "_vtk_build_
" "_all_depends
") 2394 foreach (_vtk_build_module IN LISTS _vtk_build_sorted_modules) 2395 if (NOT _vtk_build_module IN_LIST _vtk_build_MODULES) 2399 if (TARGET "${_vtk_build_module}
") 2400 get_property(_vtk_build_is_imported 2401 TARGET "${_vtk_build_module}
" 2404 # TODO: Is this right? 2405 if (NOT _vtk_build_is_imported) 2407 "The ${_vtk_build_module} module has been requested to be built, but
" 2408 "it is already built by
this project.
") 2414 foreach (_vtk_build_depend IN LISTS "_vtk_build_${_vtk_build_module}_depends
" "_vtk_build_${_vtk_build_module}_private_depends
") 2415 if (NOT TARGET "${_vtk_build_depend}
") 2417 "The ${_vtk_build_depend} dependency is missing
for ${_vtk_build_module}.
") 2421 get_property(_vtk_build_module_file GLOBAL 2422 PROPERTY "_vtk_module_${_vtk_build_module}_file
") 2423 if (NOT _vtk_build_module_file) 2425 "The requested ${_vtk_build_module} module is not a VTK module.
") 2428 _vtk_module_debug(building "@_vtk_build_module@ is being built
") 2430 get_filename_component(_vtk_build_module_dir "${_vtk_build_module_file}
" DIRECTORY) 2431 file(RELATIVE_PATH _vtk_build_module_subdir "${CMAKE_SOURCE_DIR}
" "${_vtk_build_module_dir}
") 2433 "${CMAKE_SOURCE_DIR}/${_vtk_build_module_subdir}
" 2434 "${CMAKE_BINARY_DIR}/${_vtk_build_module_subdir}
") 2436 if (NOT TARGET "${_vtk_build_module}
") 2438 "The ${_vtk_build_module} is being built, but a matching
target was
" 2443 if (_vtk_build_BUILD_WITH_KITS) 2444 foreach (_vtk_build_kit IN LISTS _vtk_build_KITS) 2445 get_property(_vtk_build_target_name GLOBAL 2446 PROPERTY "_vtk_kit_${_vtk_build_kit}_target_name
") 2447 set(_vtk_kit_source_file 2448 "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/vtk_module_kit_${_vtk_build_target_name}.c
") 2450 OUTPUT "${_vtk_kit_source_file}
" 2451 CONTENT "void vtk_module_kit_${_vtk_build_target_name}() {}\n
") 2452 add_library("${_vtk_build_target_name}
" 2453 "${_vtk_kit_source_file}
") 2454 get_property(_vtk_build_namespace GLOBAL 2455 PROPERTY "_vtk_kit_${_vtk_build_kit}_namespace
") 2456 if (_vtk_build_TARGET_NAMESPACE STREQUAL "<AUTO>
") 2457 set(_vtk_build_TARGET_NAMESPACE "${_vtk_build_namespace}
") 2459 if (NOT _vtk_build_namespace STREQUAL _vtk_build_TARGET_NAMESPACE) 2461 "The `TARGET_NAMESPACE` (${_vtk_build_TARGET_NAMESPACE}) is not the
" 2462 "same as the ${_vtk_build_kit} kit
namespace "
2463 "(${_vtk_build_namespace}).
") 2465 if (NOT _vtk_build_kit STREQUAL _vtk_build_target_name) 2466 add_library("${_vtk_build_kit}
" ALIAS 2467 "${_vtk_build_target_name}
") 2469 _vtk_module_apply_properties("${_vtk_build_target_name}
") 2470 _vtk_module_install("${_vtk_build_target_name}
") 2472 set(_vtk_build_kit_modules_object_libraries) 2473 set(_vtk_build_kit_modules_private_depends) 2475 get_property(_vtk_build_kit_modules GLOBAL 2476 PROPERTY "_vtk_kit_${_vtk_build_kit}_kit_modules
") 2477 foreach (_vtk_build_kit_module IN LISTS _vtk_build_kit_modules) 2478 get_property(_vtk_build_kit_module_target_name GLOBAL 2479 PROPERTY "_vtk_module_${_vtk_build_kit_module}_target_name
") 2480 list(APPEND _vtk_build_kit_modules_object_libraries 2481 "${_vtk_build_kit_module_target_name}-objects
") 2483 _vtk_private_kit_link_target("${_vtk_build_kit_module}
" 2484 USAGE_TARGET_NAME _vtk_build_kit_module_usage_name) 2485 if (TARGET "${_vtk_build_kit_module_usage_name}
") 2486 list(APPEND _vtk_build_kit_modules_private_depends 2487 "${_vtk_build_kit_module_usage_name}
") 2490 # Since there is no link step for modules, we need to copy the private 2491 # dependencies of the constituent modules into the kit so that their 2492 # private dependencies are actually linked. 2493 get_property(_vtk_build_kit_module_private_depends GLOBAL 2494 PROPERTY "_vtk_module_${_vtk_build_kit_module}_private_depends
") 2495 # Also grab optional dependencies since they end up being private 2497 get_property(_vtk_build_kit_module_optional_depends GLOBAL 2498 PROPERTY "_vtk_module_${_vtk_build_kit_module}_optional_depends
") 2499 foreach (_vtk_build_kit_module_private_depend IN LISTS _vtk_build_kit_module_private_depends _vtk_build_kit_module_optional_depends) 2500 if (NOT TARGET "${_vtk_build_kit_module_private_depend}
") 2504 # But we don't need to link to modules that are part of the kit we are 2506 if (NOT _vtk_build_kit_module_private_depend IN_LIST _vtk_build_kit_modules) 2507 list(APPEND _vtk_build_kit_modules_private_depends 2508 "$<LINK_ONLY:${_vtk_build_kit_module_private_depend}>
") 2513 if (_vtk_build_kit_modules_private_depends) 2514 list(REMOVE_DUPLICATES _vtk_build_kit_modules_private_depends) 2516 if (_vtk_build_kit_modules_private_links) 2517 list(REMOVE_DUPLICATES _vtk_build_kit_modules_private_links) 2520 target_link_libraries("${_vtk_build_target_name}
" 2522 ${_vtk_build_kit_modules_object_libraries} 2523 ${_vtk_build_kit_modules_private_depends}) 2524 get_property(_vtk_build_kit_library_name GLOBAL 2525 PROPERTY "_vtk_kit_${_vtk_build_kit}_library_name
") 2526 if (_vtk_build_LIBRARY_NAME_SUFFIX) 2527 string(APPEND _vtk_build_kit_library_name "-${_vtk_build_LIBRARY_NAME_SUFFIX}
") 2529 set_target_properties("${_vtk_build_target_name}
" 2531 OUTPUT_NAME "${_vtk_build_kit_library_name}
") 2535 set(_vtk_build_properties_filename "${_vtk_build_PACKAGE}-
vtk-module-properties.cmake
") 2536 set(_vtk_build_properties_install_file "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_build_properties_filename}.install
") 2537 set(_vtk_build_properties_build_file "${CMAKE_BINARY_DIR}/${_vtk_build_CMAKE_DESTINATION}/${_vtk_build_properties_filename}
") 2539 file(WRITE "${_vtk_build_properties_build_file}
") 2541 _vtk_module_write_import_prefix( 2542 "${_vtk_build_properties_install_file}
" 2543 "${_vtk_build_CMAKE_DESTINATION}
") 2545 foreach (_vtk_build_module IN LISTS _vtk_build_MODULES) 2546 get_property(_vtk_build_namespace GLOBAL 2547 PROPERTY "_vtk_module_${_vtk_build_module}_namespace
") 2548 if (_vtk_build_TARGET_NAMESPACE STREQUAL "<AUTO>
") 2549 set(_vtk_build_TARGET_NAMESPACE "${_vtk_build_namespace}
") 2551 if (NOT _vtk_build_namespace STREQUAL _vtk_build_TARGET_NAMESPACE) 2553 "The `TARGET_NAMESPACE` (${_vtk_build_TARGET_NAMESPACE}) is not the
" 2554 "same as the ${_vtk_build_module} module
namespace "
2555 "(${_vtk_build_namespace}).
") 2558 get_property(_vtk_build_is_third_party 2559 TARGET "${_vtk_build_module}
" 2560 PROPERTY "INTERFACE_vtk_module_third_party
") 2561 if (_vtk_build_is_third_party) 2562 _vtk_module_export_properties( 2563 BUILD_FILE "${_vtk_build_properties_build_file}
" 2564 INSTALL_FILE "${_vtk_build_properties_install_file}
" 2565 MODULE "${_vtk_build_module}
" 2566 FROM_GLOBAL_PROPERTIES 2567 # Export the dependencies of a module. 2571 # The library name of the module. 2574 # Export whether a module is third party or not. 2575 INTERFACE_vtk_module_third_party 2576 INTERFACE_vtk_module_exclude_wrap) 2580 set(_vtk_build_split_properties) 2581 get_property(_vtk_build_exclude_wrap 2582 TARGET "${_vtk_build_module}
" 2583 PROPERTY "INTERFACE_vtk_module_${_vtk_build_module}_exclude_wrap
") 2584 if (NOT _vtk_build_exclude_wrap) 2585 list(APPEND _vtk_build_split_properties 2587 if (_vtk_build_ENABLE_WRAPPING) 2588 list(APPEND _vtk_build_split_properties 2593 set(_vtk_build_properties_kit_properties) 2594 if (_vtk_build_BUILD_WITH_KITS) 2595 list(APPEND _vtk_build_properties_kit_properties 2596 # Export the kit membership of a module. 2600 _vtk_module_export_properties( 2601 BUILD_FILE "${_vtk_build_properties_build_file}
" 2602 INSTALL_FILE "${_vtk_build_properties_install_file}
" 2603 MODULE "${_vtk_build_module}
" 2604 FROM_GLOBAL_PROPERTIES 2605 # Export whether the module should be excluded from wrapping or not. 2607 # Export the dependencies of a module. 2611 # Export what modules are implemented by the module. 2613 # Export whether the module contains autoinit logic. 2615 # The library name of the module. 2617 ${_vtk_build_properties_kit_properties} 2619 # Export whether the module needs autoinit logic handled. 2620 INTERFACE_vtk_module_needs_autoinit 2621 # Forward private usage requirements with global effects. 2622 INTERFACE_vtk_module_forward_link 2623 SPLIT_INSTALL_PROPERTIES 2624 # Set the properties which differ between build and install trees. 2625 ${_vtk_build_split_properties}) 2628 if (_vtk_build_BUILD_WITH_KITS) 2629 foreach (_vtk_build_kit IN LISTS _vtk_build_KITS) 2630 _vtk_module_export_properties( 2631 BUILD_FILE "${_vtk_build_properties_build_file}
" 2632 INSTALL_FILE "${_vtk_build_properties_install_file}
" 2633 KIT "${_vtk_build_kit}
" 2634 FROM_GLOBAL_PROPERTIES 2635 # Export the list of modules in the kit. 2640 if (_vtk_build_INSTALL_EXPORT AND _vtk_build_INSTALL_HEADERS) 2641 set(_vtk_build_namespace) 2642 if (_vtk_build_TARGET_NAMESPACE) 2643 set(_vtk_build_namespace 2644 NAMESPACE "${_vtk_build_TARGET_NAMESPACE}::
") 2648 EXPORT "${_vtk_build_INSTALL_EXPORT}
" 2649 ${_vtk_build_namespace} 2650 FILE "${CMAKE_BINARY_DIR}/${_vtk_build_CMAKE_DESTINATION}/${_vtk_build_PACKAGE}-targets.cmake
") 2652 EXPORT "${_vtk_build_INSTALL_EXPORT}
" 2653 DESTINATION "${_vtk_build_CMAKE_DESTINATION}
" 2654 ${_vtk_build_namespace} 2655 FILE "${_vtk_build_PACKAGE}-targets.cmake
" 2656 COMPONENT "${_vtk_build_HEADERS_COMPONENT}
") 2658 if (_vtk_build_INSTALL_HEADERS) 2659 file(APPEND "${_vtk_build_properties_install_file}
" 2660 "unset(_vtk_module_import_prefix)\n
") 2663 FILES "${_vtk_build_properties_install_file}
" 2664 DESTINATION "${_vtk_build_CMAKE_DESTINATION}
" 2665 RENAME "${_vtk_build_properties_filename}
" 2666 COMPONENT "${_vtk_build_HEADERS_COMPONENT}
") 2670 get_property(_vtk_build_test_modules GLOBAL 2671 PROPERTY "_vtk_module_test_modules
") 2672 set(_vtk_build_tests_handled) 2673 foreach (_vtk_build_test IN LISTS _vtk_build_test_modules) 2674 if (NOT _vtk_build_test IN_LIST _vtk_build_MODULES) 2677 list(APPEND _vtk_build_tests_handled 2678 "${_vtk_build_test}
") 2680 get_property(_vtk_build_test_depends GLOBAL 2681 PROPERTY "_vtk_module_${_vtk_build_test}_test_depends
") 2683 set(_vtk_build_test_has_depends TRUE) 2684 foreach (_vtk_build_test_depend IN LISTS _vtk_build_test_depends) 2685 if (NOT TARGET "${_vtk_build_test_depend}
") 2686 set(_vtk_build_test_has_depends FALSE) 2687 _vtk_module_debug(testing "@_vtk_build_test@ testing disabled due to missing @_vtk_build_test_depend
@") 2690 if (NOT _vtk_build_test_has_depends) 2694 get_property(_vtk_build_module_file GLOBAL 2695 PROPERTY "_vtk_module_${_vtk_build_test}_file
") 2697 if (NOT _vtk_build_TEST_DIRECTORY_NAME STREQUAL "NONE") 2698 get_filename_component(_vtk_build_module_dir "${_vtk_build_module_file}
" DIRECTORY) 2699 file(RELATIVE_PATH _vtk_build_module_subdir "${CMAKE_SOURCE_DIR}
" "${_vtk_build_module_dir}
") 2700 if (EXISTS "${CMAKE_SOURCE_DIR}/${_vtk_build_module_subdir}/${_vtk_build_TEST_DIRECTORY_NAME}
") 2701 get_property(_vtk_build_test_labels GLOBAL 2702 PROPERTY "_vtk_module_${_vtk_build_test}_test_labels
") 2704 "${CMAKE_SOURCE_DIR}/${_vtk_build_module_subdir}/${_vtk_build_TEST_DIRECTORY_NAME}
" 2705 "${CMAKE_BINARY_DIR}/${_vtk_build_module_subdir}/${_vtk_build_TEST_DIRECTORY_NAME}
") 2710 if (_vtk_build_test_modules AND _vtk_build_tests_handled) 2711 list(REMOVE_ITEM _vtk_build_test_modules 2712 ${_vtk_build_tests_handled}) 2715 _vtk_module_test_modules "${_vtk_build_test_modules}
") 2720 @ingroup module-impl 2721 @brief Add "standard
" include directories to a module 2723 Add the "standard
" includes for a module to its interface. These are the source 2724 and build directories for the module itself. They are always either `PUBLIC` or 2725 `INTERFACE` (depending on the module's target type). 2728 _vtk_module_standard_includes( 2732 [HEADERS_DESTINATION <destination>]) 2735 function (_vtk_module_standard_includes) 2736 cmake_parse_arguments(PARSE_ARGV 0 _vtk_standard_includes 2738 "TARGET;HEADERS_DESTINATION
" 2741 if (NOT _vtk_standard_includes_TARGET) 2743 "The `TARGET` argument is required.
") 2745 if (NOT TARGET "${_vtk_standard_includes_TARGET}
") 2747 "The `TARGET` argument is not a
target.
") 2750 if (_vtk_standard_includes_UNPARSED_ARGUMENTS) 2752 "Unparsed arguments
for vtk_module_standard_includes:
" 2753 "${_vtk_standard_includes_UNPARSED_ARGUMENTS}
") 2756 set(_vtk_standard_includes_system) 2757 if (_vtk_standard_includes_SYSTEM) 2758 set(_vtk_standard_includes_system SYSTEM) 2761 set(_vtk_standard_includes_visibility PUBLIC) 2762 if (_vtk_standard_includes_INTERFACE) 2763 set(_vtk_standard_includes_visibility INTERFACE) 2766 target_include_directories("${_vtk_standard_includes_TARGET}
" 2767 ${_vtk_standard_includes_system} 2768 "${_vtk_standard_includes_visibility}
" 2769 $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> 2770 $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>) 2772 if (_vtk_build_INSTALL_HEADERS AND _vtk_standard_includes_HEADERS_DESTINATION) 2773 target_include_directories("${_vtk_standard_includes_TARGET}
" 2774 ${_vtk_standard_includes_system} 2775 "${_vtk_standard_includes_visibility}
" 2776 $<INSTALL_INTERFACE:${_vtk_standard_includes_HEADERS_DESTINATION}>) 2781 @ingroup module-impl 2782 @brief Determine the default export macro for a module 2784 Determines the export macro to be used for a module from its metadata. Assumes 2785 it is called from within a @ref vtk_module_build call. 2788 _vtk_module_default_library_name(<varname>) 2791 function (_vtk_module_default_export_macro_prefix varname) 2792 get_property(_vtk_module_default_library_name GLOBAL 2793 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
") 2794 string(TOUPPER "${_vtk_module_default_library_name}
" _vtk_default_export_macro_upper) 2796 "${_vtk_default_export_macro_upper}
" 2800 # TODO: It would be nice to support `USE_LINK_PROPERTIES` instead of listing 2801 # the modules again here. However, the format of the `LINK_LIBRARIES` property 2802 # value may not be easy to handle. 2805 @page module-overview 2808 @section module-autoinit Autoinit 2810 When a module contains a factory which may be populated by other modules, these 2811 factories need to be populated when the modules are loaded by the dynamic linker 2812 (for shared builds) or program load time (for static builds). To provide for 2813 this, the module system contains an autoinit "subsystem
". 2815 @subsection module-autoinit-leverage Leveraging the autoinit subsystem 2817 The subsystem provides the following hooks for use by projects: 2819 * In modules which `IMPLEMENTS` other modules, in the generated 2820 `<module>Module.h` header (which provides export symbols as well) will 2821 include the modules which are implemented. 2822 * In modules which are `IMPLEMENTABLE` or `IMPLEMENTS` another module, the 2823 generated `<module>Module.h` file will include the following block: 2826 #ifdef <module>_AUTOINIT_INCLUDE 2827 #include <module>_AUTOINIT_INCLUDE 2829 #ifdef <module>_AUTOINIT 2831 VTK_MODULE_AUTOINIT(<module>) 2835 The @ref vtk_module_autoinit function will generate an include file and provide 2836 its path via the `<module>_AUTOINIT_INCLUDE` define. once it has been included, 2837 if the `<module>_AUTOINIT` symbol is defined, a header is included which is 2838 intended to provide the `VTK_MODULE_AUTOINIT` macro. This macro is given the 2839 module name and should use `<module>_AUTOINIT` to fill in the factories in the 2840 module with those from the `IMPLEMENTS` modules listed in that symbol. 2842 The `<module>_AUTOINIT` symbol's value is: 2845 <count>(<module1>,<module2>,<module3>) 2848 where `<count>` is the number of modules in the parentheses and each module 2849 listed need to register something to `<module>`. 2851 If not provided via the `AUTOINIT_INCLUDE` argument to the 2852 @ref vtk_module_add_module function, the header to use is fetched from the 2853 `_vtk_module_autoinit_include` global property. This only needs to be managed 2854 in modules that `IMPLEMENTS` or are `IMPLEMENTABLE`. This should be provided by 2855 projects using the module system at its lowest level. Projects not implementing 2856 the `VTK_MODULE_AUTOINIT` macro should have its value provided by 2857 `find_package` dependencies in some way. 2862 @brief Linking to autoinit-using modules 2864 When linking to modules, in order for the autoinit system to work, modules need 2865 to declare their registration. In order to do this, defines may need to be 2866 provided to targets in order to trigger registration. These defines may be 2867 added to targets by using this function. 2870 vtk_module_autoinit( 2872 MODULES <module>...) 2875 After this call, the targets given to the `TARGETS` argument will gain the 2876 preprocessor definitions to trigger registrations properly. 2878 function (vtk_module_autoinit) 2879 cmake_parse_arguments(PARSE_ARGV 0 _vtk_autoinit 2884 if (_vtk_autoinit_UNRECOGNIZED_ARGUMENTS) 2887 "${_vtk_autoinit_UNRECOGNIZED_ARGUMENTS}.
") 2890 if (NOT _vtk_autoinit_TARGETS) 2892 "The `TARGETS` argument is required.
") 2895 if (NOT _vtk_autoinit_MODULES) 2896 message(AUTHOR_WARNING 2897 "No `MODULES` passed to `vtk_modules_autoinit`.
") 2900 set(_vtk_autoinit_module_stack 2901 ${_vtk_autoinit_MODULES}) 2903 set(_vtk_autoinit_needs_implements) 2904 set(_vtk_autoinit_seen) 2905 while (_vtk_autoinit_module_stack) 2906 list(GET _vtk_autoinit_module_stack 0 _vtk_autoinit_current_module) 2907 list(REMOVE_AT _vtk_autoinit_module_stack 0) 2908 if (_vtk_autoinit_current_module IN_LIST _vtk_autoinit_seen) 2911 list(APPEND _vtk_autoinit_seen 2912 "${_vtk_autoinit_current_module}
") 2914 _vtk_module_real_target(_vtk_autoinit_current_target "${_vtk_autoinit_current_module}
") 2915 get_property(_vtk_autoinit_implements 2916 TARGET "${_vtk_autoinit_current_target}
" 2917 PROPERTY "INTERFACE_vtk_module_implements
") 2919 list(APPEND _vtk_autoinit_needs_implements 2920 ${_vtk_autoinit_implements}) 2921 foreach (_vtk_autoinit_implement IN LISTS _vtk_autoinit_implements) 2922 _vtk_module_real_target(_vtk_autoinit_implements_target "${_vtk_autoinit_implement}
") 2923 get_property(_vtk_autoinit_implementable 2924 TARGET "${_vtk_autoinit_implements_target}
" 2925 PROPERTY "INTERFACE_vtk_module_implementable
") 2927 if (NOT _vtk_autoinit_implementable) 2929 "The `${_vtk_autoinit_current_module}` module says that it
" 2930 "implements the `${_vtk_autoinit_implement}` module, but it is not
" 2934 list(APPEND "_vtk_autoinit_implements_${_vtk_autoinit_implement}
" 2935 "${_vtk_autoinit_current_module}
") 2939 if (NOT _vtk_autoinit_needs_implements) 2942 list(REMOVE_DUPLICATES _vtk_autoinit_needs_implements) 2943 list(SORT _vtk_autoinit_needs_implements) 2945 set(_vtk_autoinit_hash_content) 2946 foreach (_vtk_autoinit_need_implements IN LISTS _vtk_autoinit_needs_implements) 2947 if (NOT _vtk_autoinit_implements_${_vtk_autoinit_need_implements}) 2950 list(SORT "_vtk_autoinit_implements_${_vtk_autoinit_need_implements}
") 2952 string(APPEND _vtk_autoinit_hash_content 2953 "${_vtk_autoinit_need_implements}: ${_vtk_autoinit_implements_${_vtk_autoinit_need_implements}}\n
") 2955 string(MD5 _vtk_autoinit_header_tag "${_vtk_autoinit_hash_content}
") 2956 set(_vtk_autoinit_header 2957 "${CMAKE_BINARY_DIR}/CMakeFiles/vtkModuleAutoInit_${_vtk_autoinit_header_tag}.h
") 2959 get_property(_vtk_autoinit_header_generated GLOBAL 2960 PROPERTY "_vtk_autoinit_generated_${_vtk_autoinit_header_tag}
") 2962 set(_vtk_autoinit_defines) 2963 set(_vtk_autoinit_header_content) 2964 foreach (_vtk_autoinit_need_implements IN LISTS _vtk_autoinit_needs_implements) 2965 if (NOT _vtk_autoinit_implements_${_vtk_autoinit_need_implements}) 2969 get_property(_vtk_autoinit_implements_library_name 2970 TARGET "${_vtk_autoinit_need_implements}
" 2971 PROPERTY "INTERFACE_vtk_module_library_name
") 2973 if (NOT _vtk_autoinit_header_generated) 2974 list(LENGTH "_vtk_autoinit_implements_${_vtk_autoinit_need_implements}
" 2975 _vtk_autoinit_length) 2976 set(_vtk_autoinit_args) 2977 foreach (_vtk_autoinit_arg IN LISTS "_vtk_autoinit_implements_${_vtk_autoinit_need_implements}
") 2978 get_property(_vtk_autoinit_arg_library_name 2979 TARGET "${_vtk_autoinit_arg}
" 2980 PROPERTY "INTERFACE_vtk_module_library_name
") 2981 list(APPEND _vtk_autoinit_args 2982 "${_vtk_autoinit_arg_library_name}
") 2984 string(REPLACE ";
" ",
" _vtk_autoinit_args "${_vtk_autoinit_args}
") 2985 string(APPEND _vtk_autoinit_header_content 2986 "#define ${_vtk_autoinit_implements_library_name}_AUTOINIT ${_vtk_autoinit_length}(${_vtk_autoinit_args})\n
") 2989 list(APPEND _vtk_autoinit_defines 2990 "${_vtk_autoinit_implements_library_name}_AUTOINIT_INCLUDE=\
"${_vtk_autoinit_header}\"")
2993 if (NOT _vtk_autoinit_header_generated)
2995 OUTPUT
"${_vtk_autoinit_header}" 2996 CONTENT
"${_vtk_autoinit_header_content}")
3000 "_vtk_autoinit_generated_${_vtk_autoinit_header_tag}" TRUE)
3003 foreach (_vtk_autoinit_target IN LISTS _vtk_autoinit_TARGETS)
3004 get_property(_vtk_autoinit_target_type
3005 TARGET
"${_vtk_autoinit_target}" 3007 if (_vtk_autoinit_target_type STREQUAL
"INTERFACE_LIBRARY")
3011 target_compile_definitions(
"${_vtk_autoinit_target}" 3013 ${_vtk_autoinit_defines})
3018 @ingroup module-impl
3019 @brief Generate the hierarchy
for a module
3021 Write wrap hierarchy files
for the module currently being built. This also
3022 installs the hierarchy file
for use by dependent projects
if `INSTALL_HEADERS`
3030 file(MAKE_DIRECTORY
"${CMAKE_BINARY_DIR}/${_vtk_build_HIERARCHY_DESTINATION}")
3032 get_property(_vtk_hierarchy_library_name GLOBAL
3033 PROPERTY
"_vtk_module_${_vtk_build_module}_library_name")
3034 set(_vtk_hierarchy_filename
"${_vtk_hierarchy_library_name}-hierarchy.txt")
3035 set(_vtk_hierarchy_file
"${CMAKE_BINARY_DIR}/${_vtk_build_HIERARCHY_DESTINATION}/${_vtk_hierarchy_filename}")
3036 set(_vtk_hierarchy_args_file
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_hierarchy_library_name}-hierarchy.$<CONFIGURATION>.args")
3037 set(_vtk_hierarchy_data_file
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_hierarchy_library_name}-hierarchy.data")
3038 set(_vtk_hierarchy_depends_args_file
"${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${_vtk_hierarchy_library_name}-hierarchy.depends.args")
3040 set_property(TARGET
"${_vtk_add_module_real_target}" 3042 "INTERFACE_vtk_module_hierarchy" "${_vtk_hierarchy_file}")
3044 set(_vtk_add_module_target_name_iface
"${_vtk_add_module_target_name}")
3045 if (_vtk_add_module_build_with_kit)
3046 string(APPEND _vtk_add_module_target_name_iface
"-objects")
3048 set(_vtk_hierarchy_genex_compile_definitions
3049 "$<TARGET_PROPERTY:${_vtk_add_module_target_name_iface},COMPILE_DEFINITIONS>
") 3050 set(_vtk_hierarchy_genex_include_directories 3051 "$<TARGET_PROPERTY:${_vtk_add_module_target_name_iface},INCLUDE_DIRECTORIES>
") 3053 OUTPUT "${_vtk_hierarchy_args_file}
" 3054 CONTENT "$<$<BOOL:${_vtk_hierarchy_genex_compile_definitions}>:\n-D\
'$<JOIN:${_vtk_hierarchy_genex_compile_definitions},\'\n-D\'>\'>\n 3055 $<$<BOOL:${_vtk_hierarchy_genex_include_directories}>:\n-I\'$<JOIN:${_vtk_hierarchy_genex_include_directories},\'\n-I\'>\'>\n") 3057 get_property(_vtk_hierarchy_depends_is_global GLOBAL 3058 PROPERTY "_vtk_module_${_vtk_build_module}_depends" 3060 if (_vtk_hierarchy_depends_is_global) 3061 get_property(_vtk_hierarchy_depends GLOBAL 3062 PROPERTY "_vtk_module_${_vtk_build_module}_depends") 3064 get_property(_vtk_hierarchy_depends GLOBAL 3065 TARGET "${_vtk_add_module_real_target}" 3066 PROPERTY "INTERFACE_vtk_module_depends") 3069 set(_vtk_hierarchy_depends_files) 3070 set(_vtk_hierarchy_depends_targets) 3071 foreach (_vtk_hierarchy_depend IN LISTS _vtk_hierarchy_depends) 3072 _vtk_module_get_module_property("${_vtk_hierarchy_depend}" 3073 PROPERTY "hierarchy" 3074 VARIABLE _vtk_hierarchy_depend_hierarchy) 3075 if (NOT DEFINED _vtk_hierarchy_depend_hierarchy) 3079 list(APPEND _vtk_hierarchy_depends_files 3080 "${_vtk_hierarchy_depend_hierarchy}") 3082 # Find the hierarchy target of the module. 3083 get_property(_vtk_hierarchy_module_is_imported 3084 TARGET "${_vtk_hierarchy_depend}" 3086 # Imported target modules are external and should already have their file 3088 if (_vtk_hierarchy_module_is_imported) 3092 get_property(_vtk_hierarchy_depend_library_name GLOBAL 3093 PROPERTY "_vtk_module_${_vtk_hierarchy_depend}_library_name") 3094 if (TARGET "${_vtk_hierarchy_depend_library_name}-hierarchy") 3095 list(APPEND _vtk_hierarchy_depends_targets 3096 "${_vtk_hierarchy_depend_library_name}-hierarchy") 3100 set(_vtk_hierarchy_depends_files_arg) 3101 if (_vtk_hierarchy_depends_files) 3103 OUTPUT "${_vtk_hierarchy_depends_args_file}" 3104 CONTENT "\"$<JOIN:${_vtk_hierarchy_depends_files},\"\n\">\"\n") 3107 OUTPUT "${_vtk_hierarchy_depends_args_file}" 3111 _vtk_module_get_module_property("${_vtk_build_module}" 3113 VARIABLE _vtk_hierarchy_headers) 3114 set(_vtk_hierarchy_data_content "") 3115 foreach (_vtk_hierarchy_header IN LISTS _vtk_hierarchy_headers) 3116 string(APPEND _vtk_hierarchy_data_content 3117 "${_vtk_hierarchy_header};${_vtk_hierarchy_library_name}\n") 3120 OUTPUT "${_vtk_hierarchy_data_file}" 3121 CONTENT "${_vtk_hierarchy_data_content}") 3123 if (CMAKE_GENERATOR MATCHES "Ninja") 3124 set(_vtk_hierarchy_command_depends ${_vtk_hierarchy_depends_files}) 3126 set(_vtk_hierarchy_command_depends ${_vtk_hierarchy_depends_targets}) 3129 set(_vtk_hierarchy_tool_target "VTK::WrapHierarchy") 3130 set(_vtk_hierarchy_macros_args) 3131 if (TARGET VTKCompileTools::WrapHierarchy) 3132 set(_vtk_hierarchy_tool_target "VTKCompileTools::WrapHierarchy") 3133 if (TARGET VTKCompileTools_macros) 3134 list(APPEND _vtk_hierarchy_command_depends 3135 "VTKCompileTools_macros") 3136 list(APPEND _vtk_hierarchy_macros_args 3138 -imacros "${_VTKCompileTools_macros_file}") 3143 OUTPUT "${_vtk_hierarchy_file}" 3144 COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} 3145 "$<TARGET_FILE:${_vtk_hierarchy_tool_target}>" 3146 "@${_vtk_hierarchy_args_file}" 3147 -o "${_vtk_hierarchy_file}" 3148 "${_vtk_hierarchy_data_file}" 3149 "@${_vtk_hierarchy_depends_args_file}" 3150 ${_vtk_hierarchy_macros_args} 3151 COMMENT "Generating the wrap hierarchy for ${_vtk_build_module}" 3153 ${_vtk_hierarchy_headers} 3154 "${_vtk_hierarchy_args_file}" 3155 "${_vtk_hierarchy_data_file}" 3156 "${_vtk_hierarchy_depends_args_file}" 3157 ${_vtk_hierarchy_command_depends}) 3158 add_custom_target("${_vtk_add_module_library_name}-hierarchy" ALL 3160 "${_vtk_hierarchy_file}" 3161 "$<TARGET_FILE:${_vtk_hierarchy_tool_target}>") 3162 set_property(TARGET "${_vtk_add_module_real_target}" 3164 "INTERFACE_vtk_module_hierarchy" "${_vtk_hierarchy_file}") 3166 if (_vtk_build_INSTALL_HEADERS) 3167 set(_vtk_hierarchy_headers_component "${_vtk_build_HEADERS_COMPONENT}") 3168 if (_vtk_build_TARGET_SPECIFIC_COMPONENTS) 3169 string(PREPEND _vtk_hierarchy_headers_component "${_vtk_build_module}-") 3170 if (_vtk_build_BUILD_WITH_KITS) 3171 get_property(_vtk_hierarchy_build_with_kit GLOBAL 3172 PROPERTY "_vtk_module_${_vtk_build_module}_kit") 3173 if (_vtk_hierarchy_build_with_kit) 3174 set(_vtk_hierarchy_headers_component "${_vtk_hierarchy_build_with_kit}-${_vtk_build_HEADERS_COMPONENT}") 3178 set_property(TARGET "${_vtk_add_module_real_target}" 3180 "INTERFACE_vtk_module_hierarchy_install" "\${_vtk_module_import_prefix}/${_vtk_build_HIERARCHY_DESTINATION}/${_vtk_hierarchy_filename}") 3182 FILES "${_vtk_hierarchy_file}" 3183 DESTINATION "${_vtk_build_HIERARCHY_DESTINATION}" 3184 RENAME "${_vtk_hierarchy_filename}" 3185 COMPONENT "${_vtk_hierarchy_headers_component}") 3189 include(GenerateExportHeader) 3193 @brief Create a module library 3196 vtk_module_add_module(<name> 3197 [FORCE_STATIC] [HEADER_ONLY] 3198 [EXPORT_MACRO_PREFIX <prefix>] 3199 [HEADERS_SUBDIR <subdir>] 3200 [LIBRARY_NAME_SUFFIX <suffix>] 3201 [CLASSES <class>...] 3202 [TEMPLATE_CLASSES <template class>...] 3203 [SOURCES <source>...] 3204 [HEADERS <header>...] 3205 [NOWRAP_HEADERS <header>...] 3206 [TEMPLATES <template>...] 3207 [PRIVATE_CLASSES <class>...] 3208 [PRIVATE_TEMPLATE_CLASSES <template class>...] 3209 [PRIVATE_HEADERS <header>...] 3210 [PRIVATE_TEMPLATES <template>...]) 3213 The `PRIVATE_` arguments are analogous to their non-`PRIVATE_` arguments, but 3214 the associated files are not installed or available for wrapping (`SOURCES` are 3215 always private, so there is no `PRIVATE_` variant for that argument). 3217 * `FORCE_STATIC`: For a static library to be created. If not provided, 3218 `BUILD_SHARED_LIBS` will control the library type. 3219 * `HEADER_ONLY`: The module only contains headers (or templates) and contains 3220 no compilation steps. Mutually exclusive with `FORCE_STATIC`. 3221 * `EXPORT_MACRO_PREFIX`: The prefix for the export macro definitions. 3222 Defaults to the library name of the module in all uppercase. 3223 * `HEADERS_SUBDIR`: The subdirectory to install headers into in the install 3225 * `LIBRARY_NAME_SUFFIX`: The suffix to the module's library
name if 3226 additional information is required.
3227 * `CLASSES`: A list of classes in the module. This is a shortcut
for adding
3228 `<
class>.cxx` to `SOURCES` and `<
class>.h` to `HEADERS`.
3229 * `TEMPLATE_CLASSES`: A list of
template classes in the module. This is a
3230 shortcut
for adding `<
class>.txx` to `TEMPLATES` and `<
class>.h` to
3232 * `SOURCES`: A list of
source files which require compilation.
3233 * `HEADERS`: A list of header files which will be available
for wrapping and
3235 * `NOWRAP_HEADERS`: A list of header files which will not be available
for 3236 wrapping but installed.
3237 * `TEMPLATES`: A list of
template files which will be installed.
3240 if (NOT name STREQUAL _vtk_build_module)
3242 "The ${_vtk_build_module}'s CMakeLists.txt may not add the ${name} module.")
3245 set(_vtk_add_module_source_keywords)
3246 foreach (_vtk_add_module_kind IN ITEMS CLASSES TEMPLATE_CLASSES HEADERS TEMPLATES)
3247 list(APPEND _vtk_add_module_source_keywords
3248 "${_vtk_add_module_kind}
" 3249 "PRIVATE_${_vtk_add_module_kind}
") 3252 cmake_parse_arguments(PARSE_ARGV 1 _vtk_add_module 3253 "FORCE_STATIC;HEADER_ONLY
" 3254 "EXPORT_MACRO_PREFIX;HEADERS_SUBDIR;LIBRARY_NAME_SUFFIX
" 3255 "${_vtk_add_module_source_keywords};SOURCES;NOWRAP_HEADERS
") 3257 if (_vtk_add_module_UNPARSED_ARGUMENTS) 3260 "${_vtk_add_module_UNPARSED_ARGUMENTS}
") 3263 if (NOT DEFINED _vtk_add_module_EXPORT_MACRO_PREFIX) 3264 _vtk_module_default_export_macro_prefix(_vtk_add_module_EXPORT_MACRO_PREFIX) 3267 if (_vtk_add_module_HEADER_ONLY AND _vtk_add_module_FORCE_STATIC) 3269 "The ${_vtk_build_module} module cannot be header only yet forced
" 3273 foreach (_vtk_add_module_class IN LISTS _vtk_add_module_CLASSES) 3274 list(APPEND _vtk_add_module_SOURCES 3275 "${_vtk_add_module_class}.cxx
") 3276 list(APPEND _vtk_add_module_HEADERS 3277 "${_vtk_add_module_class}.h
") 3280 foreach (_vtk_add_module_template_class IN LISTS _vtk_add_module_TEMPLATE_CLASSES) 3281 list(APPEND _vtk_add_module_TEMPLATES 3282 "${_vtk_add_module_template_class}.txx
") 3283 list(APPEND _vtk_add_module_HEADERS 3284 "${_vtk_add_module_template_class}.h
") 3287 foreach (_vtk_add_module_class IN LISTS _vtk_add_module_PRIVATE_CLASSES) 3288 list(APPEND _vtk_add_module_SOURCES 3289 "${_vtk_add_module_class}.cxx
") 3290 list(APPEND _vtk_add_module_PRIVATE_HEADERS 3291 "${_vtk_add_module_class}.h
") 3294 foreach (_vtk_add_module_template_class IN LISTS _vtk_add_module_PRIVATE_TEMPLATE_CLASSES) 3295 list(APPEND _vtk_add_module_PRIVATE_TEMPLATES 3296 "${_vtk_add_module_template_class}.txx
") 3297 list(APPEND _vtk_add_module_PRIVATE_HEADERS 3298 "${_vtk_add_module_template_class}.h
") 3301 if (NOT _vtk_add_module_SOURCES AND NOT _vtk_add_module_HEADER_ONLY) 3303 "The ${_vtk_build_module} module has no
source files.
") 3306 get_property(_vtk_add_module_third_party GLOBAL 3307 PROPERTY "_vtk_module_${_vtk_build_module}_third_party
") 3309 get_property(_vtk_add_module_library_name GLOBAL 3310 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
") 3311 set(_vtk_add_module_module_header_name 3312 "${_vtk_add_module_library_name}Module.h
") 3313 if (NOT _vtk_add_module_HEADER_ONLY AND NOT _vtk_add_module_third_party) 3314 set(_vtk_add_module_generated_header 3315 "${CMAKE_CURRENT_BINARY_DIR}/${_vtk_add_module_module_header_name}
") 3316 list(APPEND _vtk_add_module_HEADERS 3317 "${_vtk_add_module_generated_header}
") 3320 vtk_module_install_headers( 3321 FILES ${_vtk_add_module_HEADERS} 3322 ${_vtk_add_module_NOWRAP_HEADERS} 3323 ${_vtk_add_module_TEMPLATES} 3324 SUBDIR "${_vtk_add_module_HEADERS_SUBDIR}
") 3326 set(_vtk_add_module_type) 3327 if (_vtk_add_module_FORCE_STATIC) 3328 set(_vtk_add_module_type STATIC) 3331 set(_vtk_add_module_build_with_kit) 3332 if (_vtk_build_BUILD_WITH_KITS) 3333 get_property(_vtk_add_module_build_with_kit GLOBAL 3334 PROPERTY "_vtk_module_${_vtk_build_module}_kit
") 3337 get_property(_vtk_add_module_namespace GLOBAL 3338 PROPERTY "_vtk_module_${_vtk_build_module}_namespace
") 3339 get_property(_vtk_add_module_target_name GLOBAL 3340 PROPERTY "_vtk_module_${_vtk_build_module}_target_name
") 3341 set(_vtk_add_module_real_target "${_vtk_add_module_target_name}
") 3342 if (_vtk_add_module_HEADER_ONLY) 3343 if (_vtk_add_module_build_with_kit) 3345 "The module ${_vtk_build_module} is header-only, but is part of the
" 3346 "${_vtk_add_module_build_with_kit} kit. Header-only modules
do not
" 3350 add_library("${_vtk_add_module_real_target}
" INTERFACE) 3352 if (NOT _vtk_build_module STREQUAL _vtk_add_module_real_target) 3353 add_library("${_vtk_build_module}
" ALIAS 3354 "${_vtk_add_module_real_target}
") 3357 if (_vtk_add_module_build_with_kit) 3358 add_library("${_vtk_add_module_real_target}
" INTERFACE) 3359 target_link_libraries("${_vtk_add_module_real_target}
" 3361 # For usage requirements. 3362 "${_vtk_add_module_real_target}-objects
" 3363 # For the implementation. 3364 "$<LINK_ONLY:${_vtk_add_module_build_with_kit}>
") 3366 if (NOT _vtk_build_module STREQUAL _vtk_add_module_real_target) 3367 add_library("${_vtk_build_module}
" ALIAS 3368 "${_vtk_add_module_real_target}
") 3371 # Set up properties necessary for other infrastructure. 3372 set_property(TARGET "${_vtk_add_module_real_target}
" 3374 "INTERFACE_vtk_module_library_name
" "${_vtk_add_module_library_name}
") 3376 add_library("${_vtk_add_module_real_target}-objects
" OBJECT 3377 ${_vtk_add_module_SOURCES} 3378 ${_vtk_add_module_TEMPLATES} 3379 ${_vtk_add_module_PRIVATE_TEMPLATES} 3380 ${_vtk_add_module_HEADERS} 3381 ${_vtk_add_module_NOWRAP_HEADERS} 3382 ${_vtk_add_module_PRIVATE_HEADERS}) 3383 set_target_properties("${_vtk_add_module_real_target}-objects
" 3385 # Emulate the regular library as much as possible. 3386 DEFINE_SYMBOL "${_vtk_add_module_real_target}_EXPORT
" 3387 POSITION_INDEPENDENT_CODE ON) 3388 target_compile_definitions("${_vtk_add_module_real_target}-objects
" 3390 "${_vtk_add_module_real_target}_EXPORT
") 3391 string(APPEND _vtk_add_module_real_target "-objects
") 3393 add_library("${_vtk_add_module_real_target}
" ${_vtk_add_module_type} 3394 ${_vtk_add_module_SOURCES} 3395 ${_vtk_add_module_TEMPLATES} 3396 ${_vtk_add_module_HEADERS} 3397 ${_vtk_add_module_PRIVATE_HEADERS}) 3399 set_property(TARGET "${_vtk_add_module_real_target}
" 3401 POSITION_INDEPENDENT_CODE ON) 3403 if (NOT _vtk_build_module STREQUAL _vtk_add_module_real_target) 3404 add_library("${_vtk_build_module}
" ALIAS 3405 "${_vtk_add_module_real_target}
") 3410 set_property(TARGET "${_vtk_add_module_real_target}
" 3412 "INTERFACE_vtk_module_library_name
" "${_vtk_add_module_library_name}
") 3414 get_property(_vtk_add_module_depends GLOBAL 3415 PROPERTY "_vtk_module_${_vtk_build_module}_depends
") 3416 set_property(TARGET "${_vtk_add_module_real_target}
" 3418 "INTERFACE_vtk_module_depends
" "${_vtk_add_module_depends}
") 3419 set(_vtk_add_module_includes_interface) 3420 if (_vtk_add_module_HEADER_ONLY) 3421 target_link_libraries("${_vtk_add_module_real_target}
" 3423 ${_vtk_add_module_depends}) 3424 set(_vtk_add_module_includes_interface INTERFACE) 3426 get_property(_vtk_add_module_private_depends GLOBAL 3427 PROPERTY "_vtk_module_${_vtk_build_module}_private_depends
") 3429 # XXX(cmake#18484): Linking dependencies directly currently creates 3430 # circular dependencies. This logic should be removed once the minimum for 3431 # kits contains a fix for the mentioned issue. 3433 # When two modules are part of the same kit, we can get this problem: 3435 # A - iface -> A-objects <- tll - K 3438 # B - iface -> B-objects <- tll -/ 3440 # If B depends on A, it ends up with a circular dependency since A has a 3441 # `$<LINK_ONLY:K>` link. instead, munge up dependencies of intra-kit 3442 # dependencies to link to the `-objects` target instead. 3443 if (_vtk_add_module_build_with_kit) 3444 set(_vtk_add_module_depends_link) 3445 set(_vtk_add_module_private_depends_link) 3446 foreach (_vtk_add_module_depend IN LISTS _vtk_add_module_depends) 3447 get_property(_vtk_add_module_depend_kit GLOBAL 3448 PROPERTY "_vtk_module_${_vtk_add_module_depend}_kit
") 3449 if (_vtk_add_module_depend_kit STREQUAL _vtk_add_module_build_with_kit) 3450 # We're in the same kit; depend on the `-objects` library of the 3452 get_property(_vtk_add_module_depend_target_name GLOBAL 3453 PROPERTY "_vtk_module_${_vtk_add_module_depend}_target_name
") 3454 list(APPEND _vtk_add_module_depends_link 3455 "${_vtk_add_module_depend_target_name}-objects
") 3457 # Different kit, just use as normal. 3458 list(APPEND _vtk_add_module_depends_link 3459 "${_vtk_add_module_depend}
") 3462 foreach (_vtk_add_module_private_depend IN LISTS _vtk_add_module_private_depends) 3463 get_property(_vtk_add_module_private_depend_kit GLOBAL 3464 PROPERTY "_vtk_module_${_vtk_add_module_private_depend}_kit
") 3465 if (_vtk_add_module_private_depend_kit STREQUAL _vtk_add_module_build_with_kit) 3466 # We're in the same kit; depend on the `-objects` library of the 3468 get_property(_vtk_add_module_private_depend_target_name GLOBAL 3469 PROPERTY "_vtk_module_${_vtk_add_module_private_depend}_target_name
") 3470 list(APPEND _vtk_add_module_private_depends_link 3471 "${_vtk_add_module_private_depend_target_name}-objects
") 3473 # Different kit, just use as normal. 3474 list(APPEND _vtk_add_module_private_depends_link 3475 "${_vtk_add_module_private_depend}
") 3479 # Add the `DEFINE_SYMBOL` for all other modules within the same kit which 3480 # have already been processed because the direct dependencies are not 3481 # sufficient: export symbols from any included header needs to be 3482 # correct. Since modules are built in topological order, a module can 3483 # only possibly include modules in the kit which have already been built. 3484 get_property(_vtk_add_module_kit_modules GLOBAL 3485 PROPERTY "_vtk_kit_${_vtk_add_module_build_with_kit}_kit_modules
") 3486 list(REMOVE_ITEM _vtk_add_module_kit_modules "${_vtk_build_module}
") 3487 foreach (_vtk_add_module_kit_module IN LISTS _vtk_add_module_kit_modules) 3488 get_property(_vtk_add_module_kit_module_target_name GLOBAL 3489 PROPERTY "_vtk_module_${_vtk_add_module_kit_module}_target_name
") 3490 if (TARGET "${_vtk_add_module_kit_module_target_name}-objects
") 3491 get_property(_vtk_add_module_kit_module_define_symbol 3492 TARGET "${_vtk_add_module_kit_module_target_name}-objects
" 3493 PROPERTY DEFINE_SYMBOL) 3494 target_compile_definitions("${_vtk_add_module_real_target}
" 3496 "${_vtk_add_module_kit_module_define_symbol}
") 3500 set(_vtk_add_module_depends_link ${_vtk_add_module_depends}) 3501 set(_vtk_add_module_private_depends_link ${_vtk_add_module_private_depends}) 3503 target_link_libraries("${_vtk_add_module_real_target}
" 3505 ${_vtk_add_module_depends_link} 3507 ${_vtk_add_module_private_depends_link}) 3509 set(_vtk_add_module_private_depends_forward_link) 3510 foreach (_vtk_add_module_private_depend IN LISTS _vtk_add_module_depends_link _vtk_add_module_private_depends) 3511 _vtk_module_get_module_property("${_vtk_add_module_private_depend}
" 3512 PROPERTY "forward_link
" 3513 VARIABLE _vtk_add_module_forward_link) 3514 list(APPEND _vtk_add_module_private_depends_forward_link 3515 ${_vtk_add_module_forward_link}) 3518 get_property(_vtk_add_module_optional_depends GLOBAL 3519 PROPERTY "_vtk_module_${_vtk_build_module}_optional_depends
") 3520 foreach (_vtk_add_module_optional_depend IN LISTS _vtk_add_module_optional_depends) 3521 if (TARGET "${_vtk_add_module_optional_depend}
") 3522 set(_vtk_add_module_have_optional_depend 1) 3523 set(_vtk_add_module_optional_depend_link "${_vtk_add_module_optional_depend}
") 3524 if (_vtk_add_module_build_with_kit) 3525 get_property(_vtk_add_module_optional_depend_kit GLOBAL 3526 PROPERTY "_vtk_module_${_vtk_add_module_optional_depend}_kit
") 3527 if (_vtk_add_module_optional_depend_kit STREQUAL _vtk_add_module_build_with_kit) 3528 # We're in the same kit; depend on the `-objects` library of the 3529 # module to avoid circular dependency (see explanation earlier) 3530 get_property(_vtk_add_module_optional_depend_target_name GLOBAL 3531 PROPERTY "_vtk_module_${_vtk_add_module_optional_depend}_target_name
") 3532 set(_vtk_add_module_optional_depend_link "${_vtk_add_module_optional_depend_target_name}-objects
") 3535 _vtk_module_get_module_property("${_vtk_add_module_optional_depend_link}
" 3536 PROPERTY "forward_link
" 3537 VARIABLE _vtk_add_module_forward_link) 3538 list(APPEND _vtk_add_module_private_depends_forward_link 3539 ${_vtk_add_module_forward_link}) 3540 target_link_libraries("${_vtk_add_module_real_target}
" 3542 "${_vtk_add_module_optional_depend_link}
") 3544 set(_vtk_add_module_have_optional_depend 0) 3546 string(REPLACE "::
" "_
" _vtk_add_module_optional_depend_safe "${_vtk_add_module_optional_depend}
") 3547 target_compile_definitions("${_vtk_add_module_real_target}
" 3549 "VTK_MODULE_ENABLE_${_vtk_add_module_optional_depend_safe}=${_vtk_add_module_have_optional_depend}
") 3552 if (_vtk_add_module_private_depends_forward_link) 3553 list(REMOVE_DUPLICATES _vtk_add_module_private_depends_forward_link) 3554 _vtk_module_set_module_property("${_vtk_build_module}
" APPEND 3555 PROPERTY "forward_link
" 3556 VALUE "${_vtk_add_module_private_depends_forward_link}
") 3557 target_link_libraries("${_vtk_add_module_real_target}
" 3559 "${_vtk_add_module_private_depends_forward_link}
") 3562 _vtk_module_standard_includes( 3563 TARGET "${_vtk_add_module_real_target}
" 3564 ${_vtk_add_module_includes_interface} 3565 HEADERS_DESTINATION "${_vtk_build_HEADERS_DESTINATION}
") 3567 vtk_module_autoinit( 3568 MODULES ${_vtk_add_module_depends} 3569 ${_vtk_add_module_private_depends} 3570 "${_vtk_build_module}
" 3571 TARGETS "${_vtk_add_module_real_target}
") 3573 set(_vtk_add_module_headers_build) 3574 set(_vtk_add_module_headers_install) 3575 # TODO: Perform this in `vtk_module_install_headers` so that manually 3576 # installed headers may participate in wrapping as well. 3577 foreach (_vtk_add_module_header IN LISTS _vtk_add_module_HEADERS) 3578 if (IS_ABSOLUTE "${_vtk_add_module_header}
") 3579 list(APPEND _vtk_add_module_headers_build 3580 "${_vtk_add_module_header}
") 3582 list(APPEND _vtk_add_module_headers_build 3583 "${CMAKE_CURRENT_SOURCE_DIR}/${_vtk_add_module_header}
") 3586 get_filename_component(_vtk_add_module_header_name "${_vtk_add_module_header}
" NAME) 3587 list(APPEND _vtk_add_module_headers_install 3588 "\${_vtk_module_import_prefix}/${_vtk_build_HEADERS_DESTINATION}/${_vtk_add_module_header_name}
") 3591 set_property(TARGET "${_vtk_add_module_real_target}
" 3593 "INTERFACE_vtk_module_headers
" "${_vtk_add_module_headers_build}
") 3594 if (_vtk_build_INSTALL_HEADERS) 3595 set_property(TARGET "${_vtk_add_module_real_target}
" 3597 "INTERFACE_vtk_module_headers_install
" "${_vtk_add_module_headers_install}
") 3600 get_property(_vtk_add_module_exclude_wrap GLOBAL 3601 PROPERTY "_vtk_module_${_vtk_build_module}_exclude_wrap
") 3602 set_property(TARGET "${_vtk_add_module_real_target}
" 3604 "INTERFACE_vtk_module_exclude_wrap
" "${_vtk_add_module_exclude_wrap}
") 3605 if (NOT _vtk_add_module_exclude_wrap AND _vtk_build_ENABLE_WRAPPING) 3606 _vtk_module_write_wrap_hierarchy() 3609 set(_vtk_add_module_module_content) 3611 if (NOT _vtk_add_module_AUTOINIT_INCLUDE) 3612 get_property(_vtk_add_module_AUTOINIT_INCLUDE GLOBAL 3613 PROPERTY "_vtk_module_autoinit_include
") 3616 set(_vtk_add_module_autoinit_include_header) 3617 if (_vtk_add_module_AUTOINIT_INCLUDE) 3618 set(_vtk_add_module_autoinit_include_header 3619 "#include ${_vtk_add_module_AUTOINIT_INCLUDE}
") 3622 set(_vtk_add_module_autoinit_depends_includes) 3623 foreach (_vtk_add_module_autoinit_dependency IN LISTS _vtk_add_module_depends) 3624 get_property(_vtk_add_module_autoinit_dependency_target_name GLOBAL 3625 PROPERTY "_vtk_module_${_vtk_add_module_autoinit_dependency}_target_name
") 3626 if (_vtk_add_module_autoinit_dependency_target_name) 3627 get_property(_vtk_add_module_depends_needs_autoinit 3628 TARGET "${_vtk_add_module_autoinit_dependency_target_name}
" 3629 PROPERTY "INTERFACE_vtk_module_needs_autoinit
") 3631 set(_vtk_add_module_autoinit_dependency_target_name 3632 "${_vtk_add_module_autoinit_dependency}
") 3633 get_property(_vtk_add_module_depends_needs_autoinit 3634 TARGET "${_vtk_add_module_autoinit_dependency}
" 3635 PROPERTY "INTERFACE_vtk_module_needs_autoinit
") 3637 if (NOT _vtk_add_module_depends_needs_autoinit) 3640 get_property(_vtk_add_module_depends_library_name 3641 TARGET "${_vtk_add_module_autoinit_dependency_target_name}
" 3642 PROPERTY "INTERFACE_vtk_module_library_name
") 3644 string(APPEND _vtk_add_module_autoinit_depends_includes 3645 "#include \
"${_vtk_add_module_depends_library_name}Module.h\"\n")
3648 set(_vtk_add_module_autoinit_content)
3649 if (_vtk_add_module_autoinit_depends_includes)
3650 string(APPEND _vtk_add_module_autoinit_content
3651 "/* AutoInit dependencies. */\n${_vtk_add_module_autoinit_depends_includes}\n")
3654 get_property(_vtk_add_module_implementable GLOBAL
3655 PROPERTY
"_vtk_module_${_vtk_build_module}_implementable")
3656 get_property(_vtk_add_module_implements GLOBAL
3657 PROPERTY
"_vtk_module_${_vtk_build_module}_implements")
3658 if (_vtk_add_module_implementable)
3659 set_property(TARGET
"${_vtk_add_module_real_target}" 3661 "INTERFACE_vtk_module_implementable" 1)
3664 if (_vtk_add_module_implementable OR _vtk_add_module_implements)
3665 set_property(TARGET
"${_vtk_add_module_real_target}" 3667 "INTERFACE_vtk_module_implements" "${_vtk_add_module_implements}")
3668 set_property(TARGET
"${_vtk_add_module_real_target}" 3670 "INTERFACE_vtk_module_needs_autoinit" 1)
3672 string(APPEND _vtk_add_module_autoinit_content
3674 /* AutoInit implementations. */ 3675 #ifdef ${_vtk_add_module_library_name}_AUTOINIT_INCLUDE 3676 #include ${_vtk_add_module_library_name}_AUTOINIT_INCLUDE 3678 #ifdef ${_vtk_add_module_library_name}_AUTOINIT 3679 ${_vtk_add_module_autoinit_include_header} 3680 VTK_MODULE_AUTOINIT(${_vtk_add_module_library_name}) 3684 string(APPEND _vtk_add_module_module_content
3685 "${_vtk_add_module_autoinit_content}")
3688 if (NOT _vtk_add_module_HEADER_ONLY AND NOT _vtk_add_module_third_party)
3689 generate_export_header(
"${_vtk_add_module_real_target}" 3690 EXPORT_MACRO_NAME
"${_vtk_add_module_EXPORT_MACRO_PREFIX}_EXPORT" 3691 NO_EXPORT_MACRO_NAME
"${_vtk_add_module_EXPORT_MACRO_PREFIX}_NO_EXPORT" 3692 DEPRECATED_MACRO_NAME
"${_vtk_add_module_EXPORT_MACRO_PREFIX}_DEPRECATED" 3693 NO_DEPRECATED_MACRO_NAME
"${_vtk_add_module_EXPORT_MACRO_PREFIX}_NO_DEPRECATED" 3694 STATIC_DEFINE
"${_vtk_add_module_EXPORT_MACRO_PREFIX}_STATIC_DEFINE" 3695 EXPORT_FILE_NAME
"${_vtk_add_module_module_header_name}" 3696 CUSTOM_CONTENT_FROM_VARIABLE _vtk_add_module_module_content)
3703 if (_vtk_add_module_build_with_kit)
3709 @ingroup module-impl
3710 @brief Add header tests
for a module
3712 @todo Move
this function out to be VTK-specific, probably into
3713 `vtkModuleTesting.cmake`. Each module would then need to manually call
this 3714 function. It currently assumes it is in VTK itself.
3721 if (NOT BUILD_TESTING)
3725 get_property(_vtk_add_header_tests_is_third_party GLOBAL
3726 PROPERTY "_vtk_module_${_vtk_build_module}_third_party
") 3727 if (_vtk_add_header_tests_is_third_party) 3731 # TODO: Add test compiles which include each header file to ensure that 3732 # public headers have their includes satisfied by a public dependency. 3735 if (NOT "Python${VTK_PYTHON_VERSION}_EXECUTABLE
") 3740 if (NOT VTK_SOURCE_DIR) 3745 NAME "${_vtk_build_module}-HeaderTest
" 3746 COMMAND "${Python${VTK_PYTHON_VERSION}_EXECUTABLE}
" 3747 # TODO: What to do when using this from a VTK install? 3748 "${VTK_SOURCE_DIR}/Testing/Core/HeaderTesting.py
" 3749 "${CMAKE_CURRENT_SOURCE_DIR}
" 3750 "${_vtk_add_module_EXPORT_MACRO}
") 3755 @brief Install headers 3757 Installing headers is done for normal modules by the @ref vtk_module_add_module 3758 function already. However, sometimes header structures are more complicated and 3759 need to be installed manually. This is common for third party modules or 3760 projects which use more than a single directory of headers for a module. 3762 To facilitate the installation of headers in various ways, the this function is 3763 available. This function honors the `INSTALL_HEADERS`, `HEADERS_DESTINATION`, 3764 and `HEADERS_COMPONENT` arguments to @ref vtk_module_build. 3767 vtk_module_install_headers( 3768 [DIRECTORIES <directory>...] 3773 Installation of header directories follows CMake's `install` function semantics 3774 with respect to trailing slashes. 3776 function (vtk_module_install_headers) 3777 cmake_parse_arguments(PARSE_ARGV 0 _vtk_install_headers 3780 "FILES;DIRECTORIES
") 3782 if (_vtk_install_headers_UNPARSED_ARGUMENTS) 3785 "${_vtk_install_headers_UNPARSED_ARGUMENTS}
") 3788 if (NOT _vtk_build_INSTALL_HEADERS) 3792 if (NOT _vtk_install_headers_FILES AND NOT _vtk_install_headers_DIRECTORIES) 3796 set(_vtk_install_headers_destination 3797 "${_vtk_build_HEADERS_DESTINATION}/${_vtk_install_headers_SUBDIR}
") 3798 set(_vtk_install_headers_headers_component "${_vtk_build_HEADERS_COMPONENT}
") 3799 if (_vtk_build_TARGET_SPECIFIC_COMPONENTS) 3800 string(PREPEND _vtk_install_headers_headers_component "${_vtk_build_module}-
") 3801 if (_vtk_build_BUILD_WITH_KITS) 3802 get_property(_vtk_install_headers_build_with_kit GLOBAL 3803 PROPERTY "_vtk_module_${_vtk_build_module}_kit
") 3804 if (_vtk_install_headers_build_with_kit) 3805 set(_vtk_install_headers_headers_component "${_vtk_install_headers_build_with_kit}-${_vtk_build_HEADERS_COMPONENT}
") 3809 if (_vtk_install_headers_FILES) 3811 FILES ${_vtk_install_headers_FILES} 3812 DESTINATION "${_vtk_install_headers_destination}
" 3813 COMPONENT "${_vtk_install_headers_headers_component}
") 3815 foreach (_vtk_install_headers_directory IN LISTS _vtk_install_headers_DIRECTORIES) 3817 DIRECTORY "${_vtk_install_headers_directory}
" 3818 DESTINATION "${_vtk_install_headers_destination}
" 3819 COMPONENT "${_vtk_install_headers_headers_component}
") 3824 @ingroup module-internal 3825 @brief Apply properties to a module 3827 Apply build properties to a target. Generally only useful to wrapping code or 3828 other modules that cannot use @ref vtk_module_add_module for some reason. 3831 _vtk_module_apply_properties(<target> 3832 [BASENAME <basename>]) 3835 If `BASENAME` is given, it will be used instead of the target name as the basis 3836 for `OUTPUT_NAME`. Full modules (as opposed to third party or other non-module 3837 libraries) always use the module's `LIBRARY_NAME` setting. 3839 The following target properties are set based on the arguments to the calling 3840 @ref vtk_module_build call: 3842 - `OUTPUT_NAME` (based on the module's `LIBRARY_NAME` and 3843 `vtk_module_build(LIBRARY_NAME_SUFFIX)`) 3844 - `VERSION` (based on `vtk_module_build(VERSION)`) 3845 - `SOVERSION` (based on `vtk_module_build(SOVERSION)`) 3846 - `DEBUG_POSTFIX` (on Windows) 3848 function (_vtk_module_apply_properties target) 3849 cmake_parse_arguments(PARSE_ARGV 1 _vtk_apply_properties 3854 if (_vtk_apply_properties_UNPARSED_ARGUMENTS) 3857 "${_vtk_apply_properties_UNPARSED_ARGUMENTS}.
") 3860 if (NOT DEFINED _vtk_apply_properties_BASENAME) 3861 set(_vtk_apply_properties_BASENAME "${
target}
") 3864 get_property(_vtk_add_module_type 3867 if (_vtk_add_module_type STREQUAL "OBJECT_LIBRARY
" OR 3868 _vtk_add_module_type STREQUAL "INTERFACE_LIBRARY
") 3872 set(_vtk_add_module_library_name "${_vtk_apply_properties_BASENAME}
") 3873 get_property(_vtk_add_module_target_name GLOBAL 3874 PROPERTY "_vtk_module_${_vtk_build_module}_target_name
") 3875 if (_vtk_add_module_target_name STREQUAL "${
target}
") 3876 get_property(_vtk_add_module_library_name GLOBAL 3877 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
") 3879 set(_vtk_add_module_output_name "${_vtk_add_module_library_name}${_vtk_add_module_LIBRARY_NAME_SUFFIX}
") 3880 if (_vtk_build_LIBRARY_NAME_SUFFIX) 3881 string(APPEND _vtk_add_module_output_name "-${_vtk_build_LIBRARY_NAME_SUFFIX}
") 3884 set_target_properties("${
target}
" 3886 OUTPUT_NAME "${_vtk_add_module_output_name}
") 3888 if (_vtk_build_VERSION AND NOT _vtk_add_module_type STREQUAL "EXECUTABLE
") 3889 set_target_properties("${
target}
" 3891 VERSION "${_vtk_build_VERSION}
") 3894 if (_vtk_build_SOVERSION) 3895 set_target_properties("${
target}
" 3897 SOVERSION "${_vtk_build_SOVERSION}
") 3901 set_target_properties("${
target}
" 3908 @ingroup module-internal 3909 @brief Install a module target 3911 Install a target within the module context. Generally only useful to wrapping 3912 code, modules that cannot use @ref vtk_module_add_module for some reason, or 3913 modules which create utility targets that need installed. 3916 _vtk_module_install(<target>) 3919 This function uses the various installation options to @ref vtk_module_build 3920 function to keep the install uniform. 3922 function (_vtk_module_install target) 3923 set(_vtk_install_export) 3924 if (_vtk_build_INSTALL_EXPORT) 3925 list(APPEND _vtk_install_export 3926 EXPORT "${_vtk_build_INSTALL_EXPORT}
") 3929 set(_vtk_install_headers_component "${_vtk_build_HEADERS_COMPONENT}
") 3930 set(_vtk_install_targets_component "${_vtk_build_TARGETS_COMPONENT}
") 3931 if (_vtk_build_TARGET_SPECIFIC_COMPONENTS) 3933 string(PREPEND _vtk_install_headers_component "${_vtk_build_kit}-
") 3934 string(PREPEND _vtk_install_targets_component "${_vtk_build_kit}-
") 3936 string(PREPEND _vtk_install_headers_component "${_vtk_build_module}-
") 3937 string(PREPEND _vtk_install_targets_component "${_vtk_build_module}-
") 3938 if (_vtk_build_BUILD_WITH_KITS) 3939 get_property(_vtk_install_kit GLOBAL 3940 PROPERTY "_vtk_module_${_vtk_build_module}_kit
") 3941 if (_vtk_install_kit) 3942 set(_vtk_install_headers_component "${_vtk_install_kit}-${_vtk_build_HEADERS_COMPONENT}
") 3943 set(_vtk_install_targets_component "${_vtk_install_kit}-${_vtk_build_TARGETS_COMPONENT}
") 3951 ${_vtk_install_export} 3954 DESTINATION "${_vtk_build_ARCHIVE_DESTINATION}
" 3955 COMPONENT "${_vtk_install_headers_component}
" 3957 DESTINATION "${_vtk_build_LIBRARY_DESTINATION}
" 3958 COMPONENT "${_vtk_install_targets_component}
" 3959 NAMELINK_COMPONENT "${_vtk_build_HEADERS_COMPONENT}
" 3961 DESTINATION "${_vtk_build_RUNTIME_DESTINATION}
" 3962 COMPONENT "${_vtk_install_targets_component}
") 3967 @brief Create a module executable 3969 Some modules may have associated executables with them. By using this function, 3970 the target will be installed following the options given to the associated 3971 @ref vtk_module_build command. Its name will also be changed according to the 3972 `LIBRARY_NAME_SUFFIX` option. 3975 vtk_module_add_executable(<name> 3978 [BASENAME <basename>] 3982 If `NO_INSTALL` is specified, the executable will not be installed. If 3983 `BASENAME` is given, it will be used as the name of the executable rather than 3986 If `DEVELOPMENT` is given, it marks the executable as a development tool and 3987 will not be installed if `INSTALL_HEADERS` is not set for the associated 3988 @ref vtk_module_build command. 3990 If the executable being built is the module, its module properties are used 3991 rather than `BASENAME`. In addition, the dependencies of the module will be 3994 function (vtk_module_add_executable name) 3995 cmake_parse_arguments(PARSE_ARGV 1 _vtk_add_executable 3996 "NO_INSTALL;DEVELOPMENT
" 4000 if (NOT _vtk_add_executable_UNPARSED_ARGUMENTS) 4002 "The ${
name} executable must have at least one
source file.
") 4005 if (_vtk_add_executable_NO_INSTALL AND _vtk_add_executable_DEVELOPMENT) 4007 "Both `NO_INSTALL` and `DEVELOPMENT` may not be specified.
") 4010 set(_vtk_add_executable_target_name "${
name}
") 4011 set(_vtk_add_executable_library_name "${
name}
") 4012 if (name STREQUAL _vtk_build_module) 4013 if (_vtk_add_executable_NO_INSTALL) 4015 "The executable ${_vtk_build_module} module may not use `NO_INSTALL`.
") 4017 if (DEFINED _vtk_add_executable_BASENAME) 4019 "The executable ${_vtk_build_module} module may not pass `BASENAME`
" 4020 "when adding the executable; it is controlled via `LIBRARY_NAME` in
" 4021 "the associated `
vtk.module` file.
") 4023 get_property(_vtk_add_executable_target_name GLOBAL 4024 PROPERTY "_vtk_module_${_vtk_build_module}_target_name
") 4025 get_property(_vtk_add_executable_library_name GLOBAL 4026 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
") 4029 if (_vtk_add_executable_DEVELOPMENT AND NOT _vtk_build_INSTALL_HEADERS) 4030 set(_vtk_add_executable_NO_INSTALL ON) 4034 set(CMAKE_BUILD_RPATH_USE_ORIGIN 1) 4036 file(RELATIVE_PATH _vtk_add_executable_relpath 4037 "/prefix/${_vtk_build_RUNTIME_DESTINATION}
" 4038 "/prefix/${_vtk_build_LIBRARY_DESTINATION}
") 4040 set(_vtk_add_executable_origin_rpath_prefix 4043 set(_vtk_add_executable_origin_rpath_prefix 4047 list(APPEND CMAKE_INSTALL_RPATH 4048 "${_vtk_add_executable_origin_rpath_prefix}/${_vtk_add_executable_relpath}
") 4051 add_executable("${_vtk_add_executable_target_name}
" 4052 ${_vtk_add_executable_UNPARSED_ARGUMENTS}) 4054 if (name STREQUAL _vtk_build_module AND NOT _vtk_add_executable_target_name STREQUAL _vtk_build_module) 4055 add_executable("${_vtk_build_module}
" ALIAS 4056 "${_vtk_add_executable_target_name}
") 4059 if (name STREQUAL _vtk_build_module) 4060 get_property(_vtk_real_target_kit GLOBAL 4061 PROPERTY "_vtk_module_${_vtk_build_module}_kit
") 4062 if (_vtk_real_target_kit) 4064 "Executable module ${_vtk_build_module} is declared to be part of a
" 4065 "kit;
this is not possible.
") 4068 get_property(_vtk_add_executable_depends GLOBAL 4069 PROPERTY "_vtk_module_${_vtk_build_module}_depends
") 4070 get_property(_vtk_add_executable_private_depends GLOBAL 4071 PROPERTY "_vtk_module_${_vtk_build_module}_private_depends
") 4072 target_link_libraries("${_vtk_add_executable_target_name}
" 4074 ${_vtk_add_executable_depends} 4076 ${_vtk_add_executable_private_depends}) 4077 get_property(_vtk_add_executable_optional_depends GLOBAL 4078 PROPERTY "_vtk_module_${_vtk_build_module}_optional_depends
") 4079 foreach (_vtk_add_executable_optional_depend IN LISTS _vtk_add_executable_optional_depends) 4080 string(REPLACE "::
" "_
" _vtk_add_executable_optional_depend_safe "${_vtk_add_executable_optional_depend}
") 4081 if (TARGET "${_vtk_add_executable_optional_depend}
") 4082 set(_vtk_add_executable_have_optional_depend 1) 4084 set(_vtk_add_executable_have_optional_depend 0) 4086 target_compile_definitions("${_vtk_add_executable_target_name}
" 4088 "VTK_MODULE_ENABLE_${_vtk_add_executable_optional_depend_safe}=${_vtk_add_executable_have_optional_depend}
") 4091 if (_vtk_module_warnings) 4092 if (_vtk_add_executable_depends) 4094 "Executable module ${_vtk_build_module} has
public dependencies;
this " 4095 "shouldn
't be necessary.") 4100 set(_vtk_add_executable_property_args) 4101 if (DEFINED _vtk_add_executable_BASENAME) 4102 list(APPEND _vtk_add_executable_property_args 4103 BASENAME "${_vtk_add_executable_BASENAME}") 4106 _vtk_module_apply_properties("${_vtk_add_executable_target_name}" 4107 ${_vtk_add_executable_property_args}) 4108 _vtk_module_standard_includes(TARGET "${_vtk_add_executable_target_name}") 4110 if (NOT _vtk_add_executable_NO_INSTALL) 4111 _vtk_module_install("${_vtk_add_executable_target_name}") 4117 @brief Find a package 4119 A wrapper around `find_package` that records information for use so that the 4120 same targets may be found when finding this package. 4122 Modules may need to find external dependencies. CMake often provides modules to 4123 find these dependencies, but when imported targets are involved, these.need to 4124 also be found from dependencies of the current project. Since the benefits of 4125 imported targets greatly outweighs not using them, it is preferred to use them. 4127 The module system provides the @ref vtk_module_find_package function in order 4128 to extend `find_package` support to include finding the dependencies from an 4129 install of the project. 4132 vtk_module_find_package( 4133 [PRIVATE] [CONFIG_MODE] 4136 [COMPONENTS <component>...] 4137 [OPTIONAL_COMPONENTS <component>...] 4138 [FORWARD_VERSION_REQ <MAJOR|MINOR|PATCH|EXACT>] 4139 [VERSION_VAR <variable>]) 4142 * `PACKAGE`: The name of the package to find. 4143 * `VERSION`: The minimum version of the package that is required. 4144 * `COMPONENTS`: Components of the package which are required. 4145 * `OPTIONAL_COMPONENTS`: Components of the package which may be missing. 4146 * `FORWARD_VERSION_REQ`: If provided, the found version will be promoted to 4147 the minimum version required matching the given version scheme. 4148 * `VERSION_VAR`: The variable to use as the provided version (defaults to 4149 `<PACKAGE>_VERSION`). It may contain `@` in which case it will be 4150 configured. This is useful for modules which only provide components of the 4151 actual version number. 4152 * `CONFIG_MODE`: If present, pass `CONFIG` to the underlying `find_package` 4154 * `PRIVATE`: The dependency should not be exported to the install. 4156 The `PACKAGE` argument is the only required argument. The rest are optional. 4158 Note that `PRIVATE` is *only* applicable for private dependencies on interface 4159 targets (basically, header libraries) because some platforms require private 4160 shared libraries dependencies to be present when linking dependent libraries 4161 and executables as well. 4163 macro (vtk_module_find_package) 4164 # This needs to be a macro because find modules typically set variables which 4165 # may need to be available in the calling scope. If we declare that it only 4166 # works with imported targets (which is the primary motivating factor behind 4167 # this function), we can instead make it a function at the cost of any 4168 # non-target variables a module might want to set being available. It is 4169 # unlikely that this will be the case for all callers. 4170 if (NOT _vtk_build_module) 4172 "`vtk_module_find_package` may only be called when building a VTK " 4176 # Note: when adding arguments here, add them to the `unset` block at the end 4178 cmake_parse_arguments(_vtk_find_package 4179 "PRIVATE;CONFIG_MODE" 4180 "PACKAGE;VERSION;FORWARD_VERSION_REQ;VERSION_VAR" 4181 "COMPONENTS;OPTIONAL_COMPONENTS" 4184 if (_vtk_find_package_UNPARSED_ARGUMENTS) 4186 "Unparsed arguments for vtk_module_find_package: " 4187 "${_vtk_find_package_UNPARSED_ARGUMENTS}") 4190 if (NOT DEFINED _vtk_find_package_PACKAGE) 4192 "The `PACKAGE` argument is required.") 4195 if (DEFINED _vtk_find_package_FORWARD_VERSION_REQ) 4196 if (_vtk_find_package_PRIVATE) 4198 "The `FORWARD_VERSION_REQ` argument is incompatible with the " 4202 if (NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MAJOR" AND 4203 NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MINOR" AND 4204 NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "PATCH" AND 4205 NOT _vtk_find_package_FORWARD_VERSION_REQ STREQUAL "EXACT") 4207 "The `FORWARD_VERSION_REQ` argument must be one of `MAJOR`, `MINOR`, " 4208 "`PATCH`, or `EXACT`.") 4212 if (NOT DEFINED _vtk_find_package_VERSION_VAR) 4213 set(_vtk_find_package_VERSION_VAR 4214 "${_vtk_find_package_PACKAGE}_VERSION") 4217 set(_vtk_find_package_config) 4218 if (_vtk_find_package_CONFIG_MODE) 4219 set(_vtk_find_package_config "CONFIG") 4222 find_package("${_vtk_find_package_PACKAGE}" 4223 ${_vtk_find_package_VERSION} 4224 ${_vtk_find_package_config} 4225 COMPONENTS ${_vtk_find_package_COMPONENTS} 4226 OPTIONAL_COMPONENTS ${_vtk_find_package_OPTIONAL_COMPONENTS}) 4227 if (NOT ${_vtk_find_package_PACKAGE}_FOUND) 4229 "Could not find the ${_vtk_find_package_PACKAGE} external dependency.") 4233 set(_vtk_find_package_optional_components_found) 4234 foreach (_vtk_find_package_optional_component IN LISTS _vtk_find_package_OPTIONAL_COMPONENTS) 4235 if (${_vtk_find_package_PACKAGE}_${_vtk_find_package_optional_component}_FOUND) 4236 list(APPEND _vtk_find_package_optional_components_found 4237 "${_vtk_find_package_optional_component}") 4241 if (NOT _vtk_find_package_PRIVATE) 4242 set_property(GLOBAL APPEND 4244 "_vtk_module_find_packages_${_vtk_build_PACKAGE}" "${_vtk_find_package_PACKAGE}") 4245 set(_vtk_find_package_base "_vtk_module_find_package_${_vtk_build_module}") 4246 set_property(GLOBAL APPEND 4248 "${_vtk_find_package_base}" "${_vtk_find_package_PACKAGE}") 4249 set(_vtk_find_package_base_package "${_vtk_find_package_base}_${_vtk_find_package_PACKAGE}") 4252 "${_vtk_find_package_base_package}_version" "${_vtk_find_package_VERSION}") 4255 "${_vtk_find_package_base_package}_config" "${_vtk_find_package_CONFIG_MODE}") 4256 set_property(GLOBAL APPEND 4258 "${_vtk_find_package_base_package}_components" "${_vtk_find_package_COMPONENTS}") 4259 set_property(GLOBAL APPEND 4261 "${_vtk_find_package_base_package}_optional_components" "${_vtk_find_package_OPTIONAL_COMPONENTS}") 4262 set_property(GLOBAL APPEND 4264 "${_vtk_find_package_base_package}_optional_components_found" "${_vtk_find_package_optional_components_found}") 4267 "${_vtk_find_package_base_package}_exact" "0") 4268 if (DEFINED _vtk_find_package_FORWARD_VERSION_REQ) 4269 string(FIND "${_vtk_find_package_VERSION_VAR}" "@" _vtk_find_package_idx) 4270 if (_vtk_find_package_idx EQUAL -1) 4271 if (NOT DEFINED "${_vtk_find_package_VERSION_VAR}") 4273 "The `${_vtk_find_package_VERSION_VAR}` variable is not defined.") 4275 set(_vtk_find_package_version "${${_vtk_find_package_VERSION_VAR}}") 4277 string(CONFIGURE "${_vtk_find_package_VERSION_VAR}" _vtk_find_package_version) 4279 unset(_vtk_find_package_idx) 4281 if ("${_vtk_find_package_version}" STREQUAL "") 4283 "The `${_vtk_find_package_PACKAGE}` version is empty.") 4286 if (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MAJOR") 4287 set(_vtk_find_package_version_regex "^\([^.]*\).*") 4288 elseif (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "MINOR") 4289 set(_vtk_find_package_version_regex "^\([^.]*.[^.]*\).*") 4290 elseif (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "PATCH") 4291 set(_vtk_find_package_version_regex "^\([^.]*.[^.]*.[^.]*\).*") 4292 elseif (_vtk_find_package_FORWARD_VERSION_REQ STREQUAL "EXACT") 4293 set(_vtk_find_package_version_regex "^\\(.*\\)$") 4296 "${_vtk_find_package_base_package}_exact" "1") 4299 string(REGEX REPLACE "${_vtk_find_package_version_regex}" "\\1" 4300 _vtk_find_package_found_version "${_vtk_find_package_version}") 4301 unset(_vtk_find_package_version_regex) 4302 unset(_vtk_find_package_version) 4306 "${_vtk_find_package_base_package}_version" "${_vtk_find_package_found_version}") 4307 unset(_vtk_find_package_found_version) 4311 unset(_vtk_find_package_base) 4312 unset(_vtk_find_package_base_package) 4313 unset(_vtk_find_package_COMPONENTS) 4314 unset(_vtk_find_package_FORWARD_VERSION_REQ) 4315 unset(_vtk_find_package_OPTIONAL_COMPONENTS) 4316 unset(_vtk_find_package_PACKAGE) 4317 unset(_vtk_find_package_PRIVATE) 4318 unset(_vtk_find_package_UNPARSED_ARGUMENTS) 4319 unset(_vtk_find_package_VERSION) 4320 unset(_vtk_find_package_VERSION_VAR) 4325 @brief Export find_package calls for dependencies 4327 When installing a project that is meant to be found via `find_package` from 4328 CMake, using imported targets in the build means that imported targets need to 4329 be created during the `find_package` as well. This function writes a file 4330 suitable for inclusion from a `<package>-config.cmake` file to satisfy 4331 dependencies. It assumes that the exported targets are named 4332 `${CMAKE_FIND_PACKAGE_NAME}::${component}`. Dependent packages will only be 4333 found if a requested component requires the package to be found either directly 4337 vtk_module_export_find_packages( 4338 CMAKE_DESTINATION <directory> 4339 FILE_NAME <filename> 4340 [COMPONENT <component>] 4341 MODULES <module>...) 4344 The file will be named according to the `FILE_NAME` argument will be installed 4345 into `CMAKE_DESTINATION` in the build and install trees with the given 4346 filename. If not provided, the `development` component will be used. 4348 The `vtk_module_find_package` calls made by the modules listed in `MODULES` 4349 will be exported to this file. 4351 function (vtk_module_export_find_packages) 4352 cmake_parse_arguments(PARSE_ARGV 0 _vtk_export 4354 "CMAKE_DESTINATION;FILE_NAME;COMPONENT" 4357 if (_vtk_export_UNPARSED_ARGUMENTS) 4359 "Unparsed arguments for vtk_module_export_find_packages: " 4360 "${_vtk_export_UNPARSED_ARGUMENTS}") 4363 if (NOT DEFINED _vtk_export_CMAKE_DESTINATION) 4365 "The `CMAKE_DESTINATION` is required.") 4368 if (NOT DEFINED _vtk_export_FILE_NAME) 4370 "The `FILE_NAME` is required.") 4373 if (NOT DEFINED _vtk_export_COMPONENT) 4374 set(_vtk_export_COMPONENT "development") 4377 set(_vtk_export_output_file 4378 "${CMAKE_BINARY_DIR}/${_vtk_export_CMAKE_DESTINATION}/${_vtk_export_FILE_NAME}") 4379 file(WRITE "${_vtk_export_output_file}" 4380 "set(_vtk_module_find_package_quiet) 4381 if (\${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) 4382 set(_vtk_module_find_package_quiet QUIET) 4385 set(_vtk_module_find_package_components_checked) 4386 set(_vtk_module_find_package_components_to_check 4387 \${\${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS}) 4388 set(_vtk_module_find_package_components) 4389 set(_vtk_module_find_package_components_required) 4390 while (_vtk_module_find_package_components_to_check) 4391 list(GET _vtk_module_find_package_components_to_check 0 _vtk_module_component) 4392 list(REMOVE_AT _vtk_module_find_package_components_to_check 0) 4393 if (_vtk_module_component IN_LIST _vtk_module_find_package_components_checked) 4396 list(APPEND _vtk_module_find_package_components_checked 4397 \"\${_vtk_module_component}\") 4399 list(APPEND _vtk_module_find_package_components 4400 \"\${_vtk_module_component}\") 4401 if (\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED_\${_vtk_module_component}) 4402 list(APPEND _vtk_module_find_package_components_required 4403 \"\${_vtk_module_component}\") 4406 if (TARGET \"\${CMAKE_FIND_PACKAGE_NAME}::\${_vtk_module_component}\") 4407 set(_vtk_module_find_package_component_target \"\${CMAKE_FIND_PACKAGE_NAME}::\${_vtk_module_component}\") 4408 elseif (TARGET \"\${_vtk_module_component}\") 4409 set(_vtk_module_find_package_component_target \"\${_vtk_module_component}\") 4411 # No such target for the component; skip. 4414 get_property(_vtk_module_find_package_depends 4415 TARGET \"\${_vtk_module_find_package_component_target}\" 4416 PROPERTY \"INTERFACE_vtk_module_depends\") 4417 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depends \"\${_vtk_module_find_package_depends}\") 4418 list(APPEND _vtk_module_find_package_components_to_check 4419 \${_vtk_module_find_package_depends}) 4420 get_property(_vtk_module_find_package_depends 4421 TARGET \"\${_vtk_module_find_package_component_target}\" 4422 PROPERTY \"INTERFACE_vtk_module_private_depends\") 4423 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depends \"\${_vtk_module_find_package_depends}\") 4424 list(APPEND _vtk_module_find_package_components_to_check 4425 \${_vtk_module_find_package_depends}) 4426 get_property(_vtk_module_find_package_depends 4427 TARGET \"\${_vtk_module_find_package_component_target}\" 4428 PROPERTY \"INTERFACE_vtk_module_optional_depends\") 4429 foreach (_vtk_module_find_package_depend IN LISTS _vtk_module_find_package_depends) 4430 if (TARGET \"\${_vtk_module_find_package_depend}\") 4431 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depend \"\${_vtk_module_find_package_depend}\") 4432 list(APPEND _vtk_module_find_package_components_to_check 4433 \"\${_vtk_module_find_package_depend}\") 4436 get_property(_vtk_module_find_package_depends 4437 TARGET \"\${_vtk_module_find_package_component_target}\" 4438 PROPERTY \"INTERFACE_vtk_module_forward_link\") 4439 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_depends \"\${_vtk_module_find_package_depends}\") 4440 list(APPEND _vtk_module_find_package_components_to_check 4441 \${_vtk_module_find_package_depends}) 4443 get_property(_vtk_module_find_package_kit 4444 TARGET \"\${_vtk_module_find_package_component_target}\" 4445 PROPERTY \"INTERFACE_vtk_module_kit\") 4446 if (_vtk_module_find_package_kit) 4447 get_property(_vtk_module_find_package_kit_modules 4448 TARGET \"\${_vtk_module_find_package_kit}\" 4449 PROPERTY \"INTERFACE_vtk_kit_kit_modules\") 4450 string(REPLACE \"\${CMAKE_FIND_PACKAGE_NAME}::\" \"\" _vtk_module_find_package_kit_modules \"\${_vtk_module_find_package_kit_modules}\") 4451 list(APPEND _vtk_module_find_package_components_to_check 4452 \${_vtk_module_find_package_kit_modules}) 4455 unset(_vtk_module_find_package_component_target) 4456 unset(_vtk_module_find_package_components_to_check) 4457 unset(_vtk_module_find_package_components_checked) 4458 unset(_vtk_module_component) 4459 unset(_vtk_module_find_package_depend) 4460 unset(_vtk_module_find_package_depends) 4461 unset(_vtk_module_find_package_kit) 4462 unset(_vtk_module_find_package_kit_modules) 4464 if (_vtk_module_find_package_components) 4465 list(REMOVE_DUPLICATES _vtk_module_find_package_components) 4467 if (_vtk_module_find_package_components_required) 4468 list(REMOVE_DUPLICATES _vtk_module_find_package_components_required) 4471 foreach (_vtk_export_module IN LISTS _vtk_export_MODULES) 4472 get_property(_vtk_export_target_name GLOBAL 4473 PROPERTY "_vtk_module_${_vtk_export_module}_target_name") 4474 # Use the export name of the target if it has one set. 4475 get_property(_vtk_export_target_has_export_name 4476 TARGET "${_vtk_export_target_name}" 4477 PROPERTY EXPORT_NAME SET) 4478 if (_vtk_export_target_has_export_name) 4479 get_property(_vtk_export_target_name 4480 TARGET "${_vtk_export_target_name}" 4481 PROPERTY EXPORT_NAME) 4483 set(_vtk_export_base "_vtk_module_find_package_${_vtk_export_module}") 4484 get_property(_vtk_export_packages GLOBAL 4485 PROPERTY "${_vtk_export_base}") 4486 if (NOT _vtk_export_packages) 4490 file(APPEND "${_vtk_export_output_file}" 4491 "set(_vtk_module_find_package_enabled OFF) 4492 set(_vtk_module_find_package_is_required OFF) 4493 set(_vtk_module_find_package_fail_if_not_found OFF) 4494 if (_vtk_module_find_package_components) 4495 if (\"${_vtk_export_target_name}\" IN_LIST _vtk_module_find_package_components) 4496 set(_vtk_module_find_package_enabled ON) 4497 if (\"${_vtk_export_target_name}\" IN_LIST _vtk_module_find_package_components_required) 4498 set(_vtk_module_find_package_is_required \"\${\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED}\") 4499 set(_vtk_module_find_package_fail_if_not_found ON) 4503 set(_vtk_module_find_package_enabled ON) 4504 set(_vtk_module_find_package_is_required \"\${\${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED}\") 4505 set(_vtk_module_find_package_fail_if_not_found ON) 4508 if (_vtk_module_find_package_enabled) 4509 set(_vtk_module_find_package_required) 4510 if (_vtk_module_find_package_is_required) 4511 set(_vtk_module_find_package_required REQUIRED) 4514 list(REMOVE_DUPLICATES _vtk_export_packages) 4515 foreach (_vtk_export_package IN LISTS _vtk_export_packages) 4516 set(_vtk_export_base_package "${_vtk_export_base}_${_vtk_export_package}") 4517 get_property(_vtk_export_version GLOBAL 4518 PROPERTY "${_vtk_export_base_package}_version") 4519 get_property(_vtk_export_config GLOBAL 4520 PROPERTY "${_vtk_export_base_package}_config") 4521 get_property(_vtk_export_exact GLOBAL 4522 PROPERTY "${_vtk_export_base_package}_exact") 4523 get_property(_vtk_export_components GLOBAL 4524 PROPERTY "${_vtk_export_base_package}_components") 4525 get_property(_vtk_export_optional_components GLOBAL 4526 PROPERTY "${_vtk_export_base_package}_optional_components") 4527 get_property(_vtk_export_optional_components_found GLOBAL 4528 PROPERTY "${_vtk_export_base_package}_optional_components_found") 4530 # Assume that any found optional components end up being required. 4531 if (${_vtk_export_base_package}_optional_components_found) 4532 list(REMOVE_ITEM _vtk_export_optional_components 4533 ${_vtk_export_optional_components_found}) 4534 list(APPEND _vtk_export_components 4535 ${_vtk_export_optional_components_found}) 4538 set(_vtk_export_config_arg) 4539 if (_vtk_export_config) 4540 set(_vtk_export_config_arg CONFIG) 4543 set(_vtk_export_exact_arg) 4544 if (_vtk_export_exact) 4545 set(_vtk_export_exact_arg EXACT) 4548 file(APPEND "${_vtk_export_output_file}" 4549 " find_package(${_vtk_export_package} 4550 ${_vtk_export_version} 4551 ${_vtk_export_exact_arg} 4552 ${_vtk_export_config_arg} 4553 \${_vtk_module_find_package_quiet} 4554 \${_vtk_module_find_package_required} 4555 COMPONENTS ${_vtk_export_components} 4556 OPTIONAL_COMPONENTS ${_vtk_export_optional_components}) 4557 if (NOT ${_vtk_export_package}_FOUND AND _vtk_module_find_package_fail_if_not_found) 4558 if (NOT \${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) 4560 \"Could not find the \${CMAKE_FIND_PACKAGE_NAME} package due to a \" 4561 \"missing dependency: ${_vtk_export_package}\") 4563 set(\"\${CMAKE_FIND_PACKAGE_NAME}_${_vtk_export_target_name}_FOUND\" 0) 4564 list(APPEND \"\${CMAKE_FIND_PACKAGE_NAME}_${_vtk_export_target_name}_NOT_FOUND_MESSAGE\" 4565 \"Failed to find the ${_vtk_export_package} package.\") 4569 file(APPEND "${_vtk_export_output_file}" 4572 unset(_vtk_module_find_package_fail_if_not_found) 4573 unset(_vtk_module_find_package_enabled) 4574 unset(_vtk_module_find_package_required)\n\n") 4578 file(APPEND "${_vtk_export_output_file}" 4579 "unset(_vtk_module_find_package_components) 4580 unset(_vtk_module_find_package_components_required) 4581 unset(_vtk_module_find_package_quiet)\n") 4584 FILES "${CMAKE_BINARY_DIR}/${_vtk_export_CMAKE_DESTINATION}/${_vtk_export_FILE_NAME}" 4585 DESTINATION "${_vtk_export_CMAKE_DESTINATION}" 4586 COMPONENT "${_vtk_export_COMPONENT}") 4590 @page module-overview 4593 @section module-third-party Third party support 4595 The module system acknowledges that third party support is a pain and offers 4596 APIs to help wrangle them. Sometimes third party code needs a shim introduced 4597 to make it behave better, so an `INTERFACE` library to add that in is very 4598 useful. Other times, third party code is hard to ensure that it exists 4599 everywhere, so it is bundled. When that happens, the ability to select between 4600 the bundled copy and an external copy is useful. All three (and more) of these 4603 The following functions are used to handle third party modules: 4605 - @ref vtk_module_third_party 4606 - @ref vtk_module_third_party_external 4607 - @ref vtk_module_third_party_internal 4612 @brief Third party module 4614 When a project has modules which represent third party packages, there are some 4615 convenience functions to help deal with them. First, there is the meta-wrapper: 4618 vtk_module_third_party( 4619 [INTERNAL <internal arguments>...] 4620 [EXTERNAL <external arguments>...]) 4623 This offers a cache variable named `VTK_MODULE_USE_EXTERNAL_<module name>` that 4624 may be set to trigger between the internal copy and an externally provided 4625 copy. This is available as a local variable named 4626 `VTK_MODULE_USE_EXTERNAL_<library name>`. See the 4627 @ref vtk_module_third_party_external and @ref vtk_module_third_party_internal 4628 functions for the arguments supported by the `EXTERNAL` and `INTERNAL` 4629 arguments, respectively. 4631 function (vtk_module_third_party) 4632 cmake_parse_arguments(PARSE_ARGV 0 _vtk_third_party 4635 "INTERNAL;EXTERNAL") 4637 if (_vtk_third_party_UNPARSED_ARGUMENTS) 4639 "Unparsed arguments for vtk_module_third_party: " 4640 "${_vtk_third_party_UNPARSED_ARGUMENTS}") 4643 string(REPLACE "::" "_" _vtk_build_module_safe "${_vtk_build_module}") 4644 option("VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe}" 4645 "Use externally provided ${_vtk_build_module}" 4646 "${_vtk_build_USE_EXTERNAL}") 4647 mark_as_advanced("VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe}") 4648 get_property(_vtk_third_party_library_name GLOBAL 4649 PROPERTY "_vtk_module_${_vtk_build_module}_library_name") 4650 set("VTK_MODULE_USE_EXTERNAL_${_vtk_third_party_library_name}" 4651 "${VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe}}" 4654 if (VTK_MODULE_USE_EXTERNAL_${_vtk_build_module_safe}) 4655 vtk_module_third_party_external(${_vtk_third_party_EXTERNAL}) 4657 # Bubble up variables again. 4658 foreach (_vtk_third_party_variable IN LISTS _vtk_third_party_variables) 4659 set("${_vtk_third_party_variable}" 4660 "${${_vtk_third_party_variable}}" 4664 set(_vtk_third_party_has_external_support 1) 4665 vtk_module_third_party_internal(${_vtk_third_party_INTERNAL}) 4670 @ingroup module-impl 4671 @brief Mark a module as being third party 4673 Mark a module as being a third party module. 4676 _vtk_module_mark_third_party(<target>) 4679 function (_vtk_module_mark_third_party target) 4680 # TODO: `_vtk_module_set_module_property` instead. 4681 set_target_properties("${target}" 4683 "INTERFACE_vtk_module_exclude_wrap" 1 4684 "INTERFACE_vtk_module_third_party" 1) 4689 @brief External third party package 4691 A third party dependency may be expressed as a module using this function. 4692 Third party packages are found using CMake's `find_package`
function. It is
4693 highly recommended that imported targets are used to make usage easier. The
4694 module itself will be created as an `INTERFACE` library which exposes the
4701 [COMPONENTS <component>...]
4702 [OPTIONAL_COMPONENTS <component>...]
4703 [TARGETS <target>...]
4704 [INCLUDE_DIRS <path-or-variable>...]
4705 [LIBRARIES <target-or-variable>...]
4706 [DEFINITIONS <variable>...]
4707 [FORWARD_VERSION_REQ <MAJOR|MINOR|PATCH|EXACT>]
4708 [VERSION_VAR <version-spec>]
4709 [USE_VARIABLES <variable>...]
4711 [STANDARD_INCLUDE_DIRS])
4714 Only the `
PACKAGE` argument is required. The arguments are as follows:
4716 * `
PACKAGE`: (Required) The name of the package to find.
4717 * `
VERSION`: If specified, the minimum version of the dependency that must be
4719 * `COMPONENTS`: The list of components to request from the package.
4720 * `OPTIONAL_COMPONENTS`: The list of optional components to request from the
4722 * `TARGETS`: The list of targets to search
for when
using this package.
4723 Targets which
do not exist will be ignored to support different versions of
4724 a package
using different target names.
4725 * `STANDARD_INCLUDE_DIRS`: If present, standard include directories will be
4726 added to the module
target. This is usually only required
if both
internal 4727 and external are supported
for a given dependency.
4728 * `INCLUDE_DIRS`: If specified,
this is added as a `SYSTEM INTERFACE` include
4729 directory
for the
target. If a variable name is given, it will be
4731 * `LIBRARIES`: The libraries to link from the package. If a variable name is
4732 given, it will be dereferenced, however a warning that imported targets are
4733 not being used will be emitted.
4734 * `DEFINITIONS`: If specified, the given variables will be added to the
4735 target compile definitions interface.
4736 * `CONFIG_MODE`: Force `CONFIG`
mode.
4737 * `FORWARD_VERSION_REQ` and `VERSION_VAR`: See documentation
for 4739 * `USE_VARIABLES`: List of variables from the `find_package` to make
4740 available to the caller.
4743 cmake_parse_arguments(PARSE_ARGV 0 _vtk_third_party_external
4744 "STANDARD_INCLUDE_DIRS;CONFIG_MODE" 4745 "VERSION;PACKAGE;FORWARD_VERSION_REQ;VERSION_VAR" 4746 "COMPONENTS;OPTIONAL_COMPONENTS;LIBRARIES;INCLUDE_DIRS;DEFINITIONS;TARGETS;USE_VARIABLES")
4748 if (_vtk_third_party_external_UNPARSED_ARGUMENTS)
4750 "Unparsed arguments for vtk_module_third_party_external: " 4751 "${_vtk_third_party_external_UNPARSED_ARGUMENTS}")
4754 get_property(_vtk_third_party_external_is_third_party GLOBAL
4755 PROPERTY "_vtk_module_${_vtk_build_module}_third_party
") 4756 if (NOT _vtk_third_party_external_is_third_party) 4758 "The ${_vtk_build_module} has not been declared as a third party
" 4762 if (NOT DEFINED _vtk_third_party_external_PACKAGE) 4764 "The `
PACKAGE` argument is required.
") 4767 set(_vtk_third_party_external_args) 4768 if (DEFINED _vtk_third_party_external_FORWARD_VERSION_REQ) 4769 list(APPEND _vtk_third_party_external_args 4770 FORWARD_VERSION_REQ "${_vtk_third_party_external_FORWARD_VERSION_REQ}
") 4772 if (DEFINED _vtk_third_party_external_VERSION_VAR) 4773 list(APPEND _vtk_third_party_external_args 4774 VERSION_VAR "${_vtk_third_party_external_VERSION_VAR}
") 4777 if (_vtk_third_party_external_TARGETS) 4778 set(_vtk_third_party_external_config_mode) 4779 if (_vtk_third_party_external_CONFIG_MODE) 4780 set(_vtk_third_party_external_config_mode "CONFIG_MODE
") 4783 # If we have targets, they must be exported to the install as well. 4784 vtk_module_find_package( 4785 PACKAGE "${_vtk_third_party_external_PACKAGE}
" 4786 VERSION "${_vtk_third_party_external_VERSION}
" 4787 COMPONENTS ${_vtk_third_party_external_COMPONENTS} 4788 OPTIONAL_COMPONENTS ${_vtk_third_party_external_OPTIONAL_COMPONENTS} 4789 ${_vtk_third_party_external_config_mode} 4790 ${_vtk_third_party_external_args}) 4792 set(_vtk_third_party_external_config) 4793 if (_vtk_third_party_external_CONFIG_MODE) 4794 set(_vtk_third_party_external_config "CONFIG
") 4797 # If there are no targets, the install uses strings and therefore does not 4798 # need to find the dependency again. 4799 find_package("${_vtk_third_party_external_PACKAGE}
" 4800 ${_vtk_third_party_external_VERSION} 4801 ${_vtk_third_party_external_config} 4802 COMPONENTS ${_vtk_third_party_external_COMPONENTS} 4803 OPTIONAL_COMPONENTS ${_vtk_third_party_external_OPTIONAL_COMPONENTS}) 4806 get_property(_vtk_third_party_external_target_name GLOBAL 4807 PROPERTY "_vtk_module_${_vtk_build_module}_target_name
") 4809 # Check if an imported target of the same name already exists. 4810 set(_vtk_third_party_external_real_target_name 4811 "${_vtk_third_party_external_target_name}
") 4812 set(_vtk_third_party_external_using_mangled_name OFF) 4813 if (TARGET "${_vtk_third_party_external_target_name}
") 4814 # Ensure that the target collision comes from an imported target. 4815 get_property(_vtk_third_party_external_is_imported 4816 TARGET "${_vtk_third_party_external_target_name}
" 4818 if (NOT _vtk_third_party_external_is_imported) 4820 "It appears as though there is a conflicting
target named
" 4821 "`${_vtk_third_party_external_target_name}` expected to be used by
" 4822 "the `${_vtk_build_module}` module already added to the build. This
" 4823 "conflicts with the
target name expected to be used by an external
" 4824 "third party dependency.
") 4827 # If it does, we need to have a module name that is not the same as this 4828 # one. Error out if this is detected. 4829 if (_vtk_build_module STREQUAL _vtk_third_party_external_target_name) 4831 "An imported
target has the same
name used by the module system
for " 4832 "the facade of the external dependency
for `${_vtk_build_module}`.
" 4833 "This module must be either renamed or placed into a
namespace.
") 4836 # Mangle the internal name. The alias is the expected use case anyways and 4837 # since this is an INTERFACE target, there's nothing to break with respect 4838 # to `make $target` anyways. 4839 string(APPEND _vtk_third_party_external_real_target_name 4840 "_vtk_module_mangle
") 4841 set_property(GLOBAL APPEND_STRING 4842 PROPERTY "_vtk_module_${_vtk_build_module}_target_name
" 4843 "_vtk_module_mangle
") 4844 set(_vtk_third_party_external_using_mangled_name ON) 4847 add_library("${_vtk_third_party_external_real_target_name}
" INTERFACE) 4848 if (_vtk_third_party_external_using_mangled_name) 4849 set_property(TARGET "${_vtk_third_party_external_real_target_name}
" 4851 EXPORT_NAME "${_vtk_third_party_external_target_name}
") 4853 if (NOT _vtk_build_module STREQUAL _vtk_third_party_external_target_name) 4854 add_library("${_vtk_build_module}
" ALIAS 4855 "${_vtk_third_party_external_real_target_name}
") 4858 if (_vtk_third_party_external_STANDARD_INCLUDE_DIRS) 4859 _vtk_module_standard_includes(TARGET "${_vtk_third_party_external_real_target_name}
" 4863 # Try to use targets if they're specified and available. 4864 set(_vtk_third_party_external_have_targets FALSE) 4865 set(_vtk_third_party_external_used_targets FALSE) 4866 if (_vtk_third_party_external_TARGETS) 4867 set(_vtk_third_party_external_have_targets TRUE) 4868 foreach (_vtk_third_party_external_target IN LISTS _vtk_third_party_external_TARGETS) 4869 if (TARGET "${_vtk_third_party_external_target}
") 4870 target_link_libraries("${_vtk_third_party_external_real_target_name}
" 4872 "${_vtk_third_party_external_target}
") 4873 set(_vtk_third_party_external_used_targets TRUE) 4878 if (NOT _vtk_third_party_external_used_targets) 4879 if (NOT _vtk_third_party_external_have_targets) 4881 "A third party dependency
for ${_vtk_build_module} was found externally
" 4882 "using paths rather than targets; it is recommended to use imported
" 4883 "targets rather than find_library and such.
") 4886 set(_vtk_third_party_external_have_includes FALSE) 4887 foreach (_vtk_third_party_external_include_dir IN LISTS _vtk_third_party_external_INCLUDE_DIRS) 4888 if (DEFINED "${_vtk_third_party_external_include_dir}
") 4889 if (${_vtk_third_party_external_include_dir}) 4890 set(_vtk_third_party_external_have_includes TRUE) 4892 target_include_directories("${_vtk_third_party_external_real_target_name}
" SYSTEM 4893 INTERFACE "${${_vtk_third_party_external_include_dir}}
") 4897 if (_vtk_third_party_external_have_targets AND 4898 NOT _vtk_third_party_external_have_includes) 4900 "A third party dependency
for ${_vtk_build_module} has external targets
" 4901 "which were not found and no `INCLUDE_DIRS` were found either.
" 4902 "Including
this module may not work.
") 4905 foreach (_vtk_third_party_external_define IN LISTS _vtk_third_party_external_DEFINITIONS) 4906 if (DEFINED "${_vtk_third_party_external_define}
") 4907 target_compile_definitions("${_vtk_third_party_external_real_target_name}
" 4908 INTERFACE "${${_vtk_third_party_external_define}}
") 4912 set(_vtk_third_party_external_have_libraries FALSE) 4913 foreach (_vtk_third_party_external_library IN LISTS _vtk_third_party_external_LIBRARIES) 4914 if (DEFINED "${_vtk_third_party_external_library}
") 4915 if (${_vtk_third_party_external_library}) 4916 set(_vtk_third_party_external_have_libraries TRUE) 4918 target_link_libraries("${_vtk_third_party_external_real_target_name}
" 4919 INTERFACE "${${_vtk_third_party_external_library}}
") 4923 if (_vtk_third_party_external_have_targets AND 4924 NOT _vtk_third_party_external_have_libraries) 4926 "A third party dependency
for ${_vtk_build_module} has external targets
" 4927 "which were not found and no `LIBRARIES` were found either. Linking to
" 4928 "this this module may not work.
") 4932 if (DEFINED _vtk_third_party_external_USE_VARIABLES) 4933 # If we're called from `vtk_module_third_party`, the variables need bubbled 4935 if (DEFINED _vtk_third_party_EXTERNAL) 4936 set(_vtk_third_party_variables 4937 "${_vtk_third_party_external_USE_VARIABLES}
" 4941 foreach (_vtk_third_party_external_variable IN LISTS _vtk_third_party_external_USE_VARIABLES) 4942 if (NOT DEFINED "${_vtk_third_party_external_variable}
") 4944 "The variable `${_vtk_third_party_external_variable}` was expected
" 4945 "to have been available, but was not defined.
") 4948 set("${_vtk_third_party_external_variable}
" 4949 "${${_vtk_third_party_external_variable}}
" 4954 _vtk_module_mark_third_party("${_vtk_third_party_external_real_target_name}
") 4955 _vtk_module_install("${_vtk_third_party_external_real_target_name}
") 4960 @brief Internal third party package 4962 Third party modules may also be bundled with the project itself. In this case, 4963 it is an internal third party dependency. The dependency is assumed to be in a 4964 subdirectory that will be used via `add_subdirectory`. Unless it is marked as 4965 `HEADERS_ONLY`, it is assumed that it will create a target with the name of the 4969 vtk_module_third_party_internal( 4970 [SUBDIRECTORY <path>] 4971 [HEADERS_SUBDIR <subdir>] 4972 [LICENSE_FILES <file>...] 4976 [STANDARD_INCLUDE_DIRS]) 4979 All arguments are optional, however warnings are emitted if `LICENSE_FILES` or 4980 `VERSION` is not specified. They are as follows: 4982 * `SUBDIRECTORY`: (Defaults to the library name of the module) The 4983 subdirectory containing the `CMakeLists.txt` for the dependency. 4984 * `HEADERS_SUBDIR`: If non-empty, the subdirectory to use for installing 4986 * `LICENSE_FILES`: A list of license files to install for the dependency. If 4987 not given, a warning will be emitted. 4988 * `VERSION`: The version of the library that is included. 4989 * `HEADER_ONLY`: The dependency is header only and will not create a target. 4990 * `INTERFACE`: The dependency is an `INTERFACE` library. 4991 * `STANDARD_INCLUDE_DIRS`: If present, module-standard include directories 4992 will be added to the module target. 4994 function (vtk_module_third_party_internal) 4995 # TODO: Support scanning for third-party modules which don't support an 4998 cmake_parse_arguments(PARSE_ARGV 0 _vtk_third_party_internal 4999 "INTERFACE;HEADER_ONLY;STANDARD_INCLUDE_DIRS
" 5000 "SUBDIRECTORY;HEADERS_SUBDIR;
VERSION" 5003 if (_vtk_third_party_internal_UNPARSED_ARGUMENTS) 5006 "${_vtk_third_party_internal_UNPARSED_ARGUMENTS}
") 5009 get_property(_vtk_third_party_internal_is_third_party GLOBAL 5010 PROPERTY "_vtk_module_${_vtk_build_module}_third_party
") 5011 if (NOT _vtk_third_party_internal_is_third_party) 5013 "The ${_vtk_build_module} has not been declared as a third party
" 5017 get_property(_vtk_third_party_internal_library_name GLOBAL 5018 PROPERTY "_vtk_module_${_vtk_build_module}_library_name
") 5019 if (NOT DEFINED _vtk_third_party_internal_SUBDIRECTORY) 5020 set(_vtk_third_party_internal_SUBDIRECTORY "${_vtk_third_party_internal_library_name}
") 5023 if (NOT DEFINED _vtk_third_party_internal_LICENSE_FILES) 5025 "The ${_vtk_build_module} third party
package is embedded, but does not "
5026 "specify any license files.")
5029 if (NOT DEFINED _vtk_third_party_internal_VERSION)
5031 "The ${_vtk_build_module} third party package is embedded, but does not "
5032 "specify the version it is based on.")
5035 get_property(_vtk_third_party_internal_target_name GLOBAL
5036 PROPERTY "_vtk_module_${_vtk_build_module}_target_name")
5037 set(_vtk_third_party_internal_include_type)
5038 if (_vtk_third_party_internal_INTERFACE)
5039 set(_vtk_third_party_internal_include_type INTERFACE)
5040 elseif (_vtk_third_party_internal_HEADER_ONLY)
5041 add_library("${_vtk_third_party_internal_target_name}" INTERFACE)
5042 if (NOT _vtk_build_module STREQUAL _vtk_third_party_internal_target_name)
5043 add_library("${_vtk_build_module}" ALIAS
5044 "${_vtk_third_party_internal_target_name}")
5046 set(_vtk_third_party_internal_include_type INTERFACE)
5047 set(_vtk_third_party_internal_STANDARD_INCLUDE_DIRS 1)
5050 add_subdirectory("${_vtk_third_party_internal_SUBDIRECTORY}")
5052 if (NOT TARGET "${_vtk_build_module}")
5054 "The ${_vtk_build_module} is being built as an internal third party "
5055 "library, but a matching target was not created.")
5058 if (_vtk_third_party_internal_STANDARD_INCLUDE_DIRS)
5059 _vtk_module_standard_includes(
5060 TARGET "${_vtk_third_party_internal_target_name}"
5061 SYSTEM ${_vtk_third_party_internal_include_type}
5062 HEADERS_DESTINATION "${_vtk_build_HEADERS_DESTINATION}/${_vtk_third_party_internal_HEADERS_SUBDIR}")
5065 _vtk_module_apply_properties("${_vtk_third_party_internal_target_name}")
5066 if (_vtk_third_party_internal_INTERFACE)
5068 elseif (_vtk_third_party_internal_HEADER_ONLY)
5069 _vtk_module_install("${_vtk_third_party_internal_target_name}")
5072 if (_vtk_third_party_internal_LICENSE_FILES)
5073 set(_vtk_third_party_internal_license_component "license")
5074 if (_vtk_build_TARGET_SPECIFIC_COMPONENTS)
5075 string(PREPEND _vtk_third_party_internal_license_component "${_vtk_build_module}-")
5078 FILES ${_vtk_third_party_internal_LICENSE_FILES}
5079 DESTINATION "${_vtk_build_LICENSE_DESTINATION}/${_vtk_third_party_internal_library_name}/"
5080 COMPONENT "${_vtk_third_party_internal_license_component}")
5083 _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.
function vtk_module_third_party_internal()
Internal third party package.
boost::graph_traits< vtkGraph *>::vertex_descriptor target(boost::graph_traits< vtkGraph *>::edge_descriptor e, vtkGraph *)
function vtk_module_compile_options(module)
Add compile options to a module.
function _vtk_module_write_wrap_hierarchy()
Generate the hierarchy for a module.
function _vtk_private_kit_link_target(module)
Manage the private link target for a module.
function _vtk_module_add_header_tests()
Add header tests for a module.
function vtk_module_scan()
Scan modules and kits.
std::string replace(std::string source, const std::string &search, const std::string &replace, bool all)
function vtk_module_third_party_external()
External third party package.
function vtk_module_build()
Build modules and kits.
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.
#define BUILD_SHARED_LIBS
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_install(target)
Install a module target.
function vtk_module_autoinit()
Linking to autoinit-using modules.
function vtk_module_link_options(module)
Add link options to a module.
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.
macro vtk_module_find_package()
Find a package.