From e8e7d9f775c3811ae58de75056c68f300868081e Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 13 Dec 2023 11:28:18 -0500 Subject: FindTIFF: always find the config module quietly When the config module is not present, a spurious "tiff not found" is output before the pre-existing logic is used. Instead, silence the module and use FPHSA to report as-if `TIFF` did the search. Fixes: #25485 --- Modules/FindTIFF.cmake | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Modules/FindTIFF.cmake b/Modules/FindTIFF.cmake index 4a93c04..45b3164 100644 --- a/Modules/FindTIFF.cmake +++ b/Modules/FindTIFF.cmake @@ -66,10 +66,6 @@ The following cache variables may also be set: #]=======================================================================] set(_TIFF_args) -if (TIFF_FIND_QUIETLY) - list(APPEND _TIFF_args - QUIET) -endif () if (TIFF_FIND_VERSION) list(APPEND _TIFF_args "${TIFF_FIND_VERSION}") @@ -100,7 +96,8 @@ if (_TIFF_component_opt) OPTIONAL_COMPONENTS "${_TIFF_component_opt}") endif () unset(_TIFF_component_opt) -find_package(tiff CONFIG ${_TIFF_args}) +# Always find with QUIET to avoid noise when it is not found. +find_package(tiff CONFIG QUIET ${_TIFF_args}) unset(_TIFF_args) if (tiff_FOUND) if (NOT TARGET TIFF::TIFF) @@ -135,6 +132,12 @@ if (tiff_FOUND) set(TIFF_${_TIFF_component}_FOUND "${tiff_${_TIFF_component}_FOUND}") endforeach () unset(_TIFF_component) + + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + find_package_handle_standard_args(TIFF + HANDLE_COMPONENTS + VERSION_VAR TIFF_VERSION_STRING) + return () endif () -- cgit v0.12