diff options
author | Brad King <brad.king@kitware.com> | 2014-07-15 14:48:13 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-07-15 14:48:13 (GMT) |
commit | 0bbebd3ca1f5e5dbf68444918d0ea1acc48cb776 (patch) | |
tree | 38f9843e3085e13f7a53a68e5ca5ee8b09dac398 | |
parent | 7bc84502513febf4e5e974f3d4285baa53f0afb9 (diff) | |
parent | 0fee3f471204dd9cd47682590bf9f15da456183a (diff) | |
download | CMake-0bbebd3ca1f5e5dbf68444918d0ea1acc48cb776.zip CMake-0bbebd3ca1f5e5dbf68444918d0ea1acc48cb776.tar.gz CMake-0bbebd3ca1f5e5dbf68444918d0ea1acc48cb776.tar.bz2 |
Merge topic 'doc-package-target-import-once'
0fee3f47 Revert "Help: Update cmake-packages.7 examples to import targets only once"
-rw-r--r-- | Help/manual/cmake-packages.7.rst | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/Help/manual/cmake-packages.7.rst b/Help/manual/cmake-packages.7.rst index 5badd48..c4cca6d 100644 --- a/Help/manual/cmake-packages.7.rst +++ b/Help/manual/cmake-packages.7.rst @@ -385,12 +385,9 @@ In this case, the ``ClimbingStatsConfig.cmake`` file could be as simple as: .. code-block:: cmake - if(NOT TARGET Upstream::ClimbingStats) - include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") - endif() + include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") -This allows downstreams to use the ``IMPORTED`` targets, and guards -against importing the targets more than once. If any macros +As this allows downstreams to use the ``IMPORTED`` targets. If any macros should be provided by the ``ClimbingStats`` package, they should be in a separate file which is installed to the same location as the ``ClimbingStatsConfig.cmake`` file, and included from there. @@ -457,9 +454,7 @@ dependencies of a package should be found in the ``Config.cmake`` file: include(CMakeFindDependencyMacro) find_dependency(Stats 2.6.4) - if(NOT TARGET Upstream::ClimbingStats) - include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") - endif() + include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsMacros.cmake") The ``find_dependency`` macro also sets ``ClimbingStats_FOUND`` to ``False`` if @@ -476,9 +471,7 @@ be true. This can be tested with logic in the package configuration file: include(CMakeFindDependencyMacro) find_dependency(Stats 2.6.4) - if(NOT TARGET Upstream::ClimbingStats) - include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") - endif() + include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsTargets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/ClimbingStatsMacros.cmake") set(_supported_components Plot Table) |