diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-09-11 13:41:39 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2020-09-12 19:26:52 +0200 |
commit | 58c1c6ee5c986d502b56eb1cc57f1d9444d42031 (patch) | |
tree | 19689d29d176e78ee7fb0fcc3f77b3b225d6baca /cmake/QtPluginDependencies.cmake.in | |
parent | 55687924e3cc40b1ffc5a9038bb7e37d1ed6a19c (diff) |
CMake: Fix usage of find_dependency()
The find_dependency() macro calls return() on failure, meaning any code
after it will be ignored, thus checking any XXX_FOUND variables after
find_dependency() is pointless.
Fix the places where we use find_dependency() and set the "failed" state
before the call and the "success" state afterwards.
Change-Id: Ia5239c704f02a9bec972210374ffed7808b14055
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtPluginDependencies.cmake.in')
-rw-r--r-- | cmake/QtPluginDependencies.cmake.in | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/cmake/QtPluginDependencies.cmake.in b/cmake/QtPluginDependencies.cmake.in index eb1d9c3433..ce64b096bb 100644 --- a/cmake/QtPluginDependencies.cmake.in +++ b/cmake/QtPluginDependencies.cmake.in @@ -1,3 +1,5 @@ +set(@target@_FOUND FALSE) + # note: _third_party_deps example: "ICU\\;1.0\\;i18n uc data;ZLIB\\;\\;" set(_third_party_deps "@third_party_deps@") @@ -10,16 +12,11 @@ foreach(_target_dep ${_third_party_deps}) list(APPEND find_package_args "${version}") endif() - if(components) - string(REPLACE " " ";" components "${components}") - find_dependency(${find_package_args} COMPONENTS ${components}) - else() - find_dependency(${find_package_args}) - endif() - - if (NOT ${pkg}_FOUND) - set(@target@_FOUND FALSE) - return() + if(components) + string(REPLACE " " ";" components "${components}") + find_dependency(${find_package_args} COMPONENTS ${components}) + else() + find_dependency(${find_package_args}) endif() endforeach() @@ -34,9 +31,6 @@ foreach(_target_dep ${_target_deps}) PATHS @find_dependency_paths@ ${QT_EXAMPLES_CMAKE_PREFIX_PATH} NO_DEFAULT_PATH ) endif() - - if (NOT ${pkg}_FOUND) - set(@target@_FOUND FALSE) - return() - endif() endforeach() + +set(@target@_FOUND TRUE) |