diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2024-05-10 17:28:03 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2024-05-14 11:03:32 +0000 |
commit | 43877ca81a164c03f1e6f63c169cf35729d66da6 (patch) | |
tree | 5a8034d9cebec762a198a3c78244ae6537c76882 /cmake | |
parent | dacab833730469c3161e55d48d3bba4e34775808 (diff) |
CMake: Suppress package not found warnings in some FindWrap scripts
Some of our FindWrap scripts try to call find_package() once or more
to find a system package, and then fallback to a different source in
case if not found.
The side effect of this is that find_package() will append not found
packages to the global PACKAGES_NOT_FOUND property.
FeatureSummary feature_summary() will then list these as not found,
creating confusion.
For example while FindWrapSystemPCRE2 might be found, PCRE2 found will
be shown as not found, because we found the package via PkgConfig
instead of cmake Config file.
Manually remove these packages from the PACKAGES_NOT_FOUND property
in some of our Find scripts, to avoid the confusion.
Fixes: QTBUG-96120
Task-number: QTBUG-96394
Task-number: QTBUG-111216
Change-Id: I4be825c810248202c34f446e3cebe66574d0531c
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 70a2e7f32b9f9ce19d1538f14fbde7b0d1e77ffd)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindWrapBrotli.cmake | 7 | ||||
-rw-r--r-- | cmake/FindWrapSystemHarfbuzz.cmake | 7 | ||||
-rw-r--r-- | cmake/FindWrapSystemPCRE2.cmake | 7 | ||||
-rw-r--r-- | cmake/FindWrapZSTD.cmake | 7 |
4 files changed, 28 insertions, 0 deletions
diff --git a/cmake/FindWrapBrotli.cmake b/cmake/FindWrapBrotli.cmake index e2d7b564f6..d254f4292e 100644 --- a/cmake/FindWrapBrotli.cmake +++ b/cmake/FindWrapBrotli.cmake @@ -20,6 +20,13 @@ if (unofficial-brotli_FOUND) set(WrapBrotli_FOUND ON) else() + get_cmake_property(__packages_not_found PACKAGES_NOT_FOUND) + if(__packages_not_found) + list(REMOVE_ITEM __packages_not_found unofficial-brotli) + set_property(GLOBAL PROPERTY PACKAGES_NOT_FOUND "${__packages_not_found}") + endif() + unset(__packages_not_found) + find_package(PkgConfig QUIET) if (PKG_CONFIG_FOUND) pkg_check_modules(libbrotlidec QUIET IMPORTED_TARGET "libbrotlidec") diff --git a/cmake/FindWrapSystemHarfbuzz.cmake b/cmake/FindWrapSystemHarfbuzz.cmake index 07b3405bc0..d989c93e44 100644 --- a/cmake/FindWrapSystemHarfbuzz.cmake +++ b/cmake/FindWrapSystemHarfbuzz.cmake @@ -28,6 +28,13 @@ if(harfbuzz_FOUND AND TARGET "${__harfbuzz_target_name}") if(harfbuzz_VERSION) set(WrapSystemHarfbuzz_VERSION "${harfbuzz_VERSION}") endif() +else() + get_cmake_property(__packages_not_found PACKAGES_NOT_FOUND) + if(__packages_not_found) + list(REMOVE_ITEM __packages_not_found harfbuzz) + set_property(GLOBAL PROPERTY PACKAGES_NOT_FOUND "${__packages_not_found}") + endif() + unset(__packages_not_found) endif() if(__harfbuzz_broken_config_file OR NOT __harfbuzz_found) diff --git a/cmake/FindWrapSystemPCRE2.cmake b/cmake/FindWrapSystemPCRE2.cmake index 61e0d2fb5b..ce00252c8c 100644 --- a/cmake/FindWrapSystemPCRE2.cmake +++ b/cmake/FindWrapSystemPCRE2.cmake @@ -16,6 +16,13 @@ if(PCRE2_FOUND AND TARGET "${__pcre2_target_name}") if(PCRE2_VERSION) set(WrapSystemPCRE2_VERSION "${PCRE2_VERSION}") endif() +else() + get_cmake_property(__packages_not_found PACKAGES_NOT_FOUND) + if(__packages_not_found) + list(REMOVE_ITEM __packages_not_found PCRE2) + set_property(GLOBAL PROPERTY PACKAGES_NOT_FOUND "${__packages_not_found}") + endif() + unset(__packages_not_found) endif() if(NOT __pcre2_found) diff --git a/cmake/FindWrapZSTD.cmake b/cmake/FindWrapZSTD.cmake index fb424236b8..7e5adcf276 100644 --- a/cmake/FindWrapZSTD.cmake +++ b/cmake/FindWrapZSTD.cmake @@ -39,6 +39,13 @@ if(TARGET zstd::libzstd_static OR TARGET zstd::libzstd_shared) INTERFACE_LINK_LIBRARIES "zstd::libzstd${zstdtargetsuffix}") endif() else() + get_cmake_property(__packages_not_found PACKAGES_NOT_FOUND) + if(__packages_not_found) + list(REMOVE_ITEM __packages_not_found zstd) + set_property(GLOBAL PROPERTY PACKAGES_NOT_FOUND "${__packages_not_found}") + endif() + unset(__packages_not_found) + find_package(PkgConfig QUIET) pkg_check_modules(PC_ZSTD QUIET "libzstd") |