diff options
author | Damien R <9464-damienrg@users.noreply.gitlab.kitware.com> | 2019-03-28 23:47:23 (GMT) |
---|---|---|
committer | Damien R <9464-damienrg@users.noreply.gitlab.kitware.com> | 2019-03-29 21:03:21 (GMT) |
commit | 37da6af17d0d2cc8b499dc58f74866351e06c288 (patch) | |
tree | d7af06b514d0af13f072a0d05ca77ad42d085630 /Modules/CMakeFindDependencyMacro.cmake | |
parent | 14b6cd497f0e27dc5d02d678fcab0ca1492a320b (diff) | |
download | CMake-37da6af17d0d2cc8b499dc58f74866351e06c288.zip CMake-37da6af17d0d2cc8b499dc58f74866351e06c288.tar.gz CMake-37da6af17d0d2cc8b499dc58f74866351e06c288.tar.bz2 |
find_dependency: Always search dependencies
When a dependency was already found, find_dependency did not search it
again. While this works in basic case, it does not when there are
components as the check does not take components into account.
Given the fact that there is no documentation about this optimization and
that the correct implementation is not trivial as it would require
changes in find_package to have the list of components already found we
always search dependencies.
Fix #17583.
Diffstat (limited to 'Modules/CMakeFindDependencyMacro.cmake')
-rw-r--r-- | Modules/CMakeFindDependencyMacro.cmake | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/Modules/CMakeFindDependencyMacro.cmake b/Modules/CMakeFindDependencyMacro.cmake index ab22701..bcdfbeb 100644 --- a/Modules/CMakeFindDependencyMacro.cmake +++ b/Modules/CMakeFindDependencyMacro.cmake @@ -31,35 +31,33 @@ CMakeFindDependencyMacro #]=======================================================================] macro(find_dependency dep) - if (NOT ${dep}_FOUND) - set(cmake_fd_quiet_arg) - if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - set(cmake_fd_quiet_arg QUIET) - endif() - set(cmake_fd_required_arg) - if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) - set(cmake_fd_required_arg REQUIRED) - endif() + set(cmake_fd_quiet_arg) + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + set(cmake_fd_quiet_arg QUIET) + endif() + set(cmake_fd_required_arg) + if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED) + set(cmake_fd_required_arg REQUIRED) + endif() - get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY - _CMAKE_${dep}_TRANSITIVE_DEPENDENCY - ) + get_property(cmake_fd_alreadyTransitive GLOBAL PROPERTY + _CMAKE_${dep}_TRANSITIVE_DEPENDENCY + ) - find_package(${dep} ${ARGN} - ${cmake_fd_quiet_arg} - ${cmake_fd_required_arg} - ) + find_package(${dep} ${ARGN} + ${cmake_fd_quiet_arg} + ${cmake_fd_required_arg} + ) - if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_alreadyTransitive) - set_property(GLOBAL PROPERTY _CMAKE_${dep}_TRANSITIVE_DEPENDENCY TRUE) - endif() + if(NOT DEFINED cmake_fd_alreadyTransitive OR cmake_fd_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) - return() - endif() - set(cmake_fd_required_arg) - set(cmake_fd_quiet_arg) + 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) + return() endif() + set(cmake_fd_required_arg) + set(cmake_fd_quiet_arg) endmacro() |