summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeFindDependencyMacro.cmake
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2014-02-03 19:18:37 (GMT)
committerStephen Kelly <steveire@gmail.com>2014-02-03 19:20:42 (GMT)
commita6971f6510e532b10f6548f0b77592f41faba38f (patch)
tree9d3d48a66a526bf731f416f75079e88c9ec1aa1f /Modules/CMakeFindDependencyMacro.cmake
parentcd711ed0526de706c17c228e06f5010772cd217c (diff)
downloadCMake-a6971f6510e532b10f6548f0b77592f41faba38f.zip
CMake-a6971f6510e532b10f6548f0b77592f41faba38f.tar.gz
CMake-a6971f6510e532b10f6548f0b77592f41faba38f.tar.bz2
FeatureSummary: Don't list transitive package dependencies
Set a global property in the find_package implementation. Track and reset that property in the find_dependency macro. Read the property in FeatureSummary when determining whether to print output. This means that packages which are found only as dependencies are not listed by FeatureSummary, but if a project uses find_package elsewhere directly, then it will be listed by FeatureSummary. Suggested-by: Alex Merry http://thread.gmane.org/gmane.comp.kde.devel.frameworks/10640
Diffstat (limited to 'Modules/CMakeFindDependencyMacro.cmake')
-rw-r--r--Modules/CMakeFindDependencyMacro.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/Modules/CMakeFindDependencyMacro.cmake b/Modules/CMakeFindDependencyMacro.cmake
index 596c6fc..0f1f56d 100644
--- a/Modules/CMakeFindDependencyMacro.cmake
+++ b/Modules/CMakeFindDependencyMacro.cmake
@@ -45,7 +45,16 @@ macro(find_dependency dep)
set(required_arg REQUIRED)
endif()
+ get_property(alreadyTransitive GLOBAL PROPERTY
+ _CMAKE_${dep}_TRANSITIVE_DEPENDENCY
+ )
+
find_package(${dep} ${version} ${exact_arg} ${quiet_arg} ${required_arg})
+
+ if(NOT DEFINED alreadyTransitive OR alreadyTransitive)
+ set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE)
+ endif()
+
if (NOT ${dep}_FOUND)
set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "${CMAKE_FIND_PACKAGE_NAME} could not be found because dependency ${dep} could not be found.")
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND False)