From d892dedf2253127c85a443330630c6a9704c5e28 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 13 Dec 2023 11:28:18 -0500 Subject: FindFreetype: always find the config module quietly When the config module is not present, a spurious "freetype not found" is output before the pre-existing logic is used. Instead, silence the module and use FPHSA to report as-if `Freetype` did the search. See: #25485 --- Modules/FindFreetype.cmake | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index 583d056..32b2e06 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -66,10 +66,6 @@ directory of a Freetype installation. # everything still works. set(_Freetype_args) -if (Freetype_FIND_QUIETLY) - list(APPEND _Freetype_args - QUIET) -endif () if (Freetype_FIND_VERSION) list(APPEND _Freetype_args "${Freetype_FIND_VERSION}") @@ -100,7 +96,8 @@ if (_Freetype_component_opt) OPTIONAL_COMPONENTS "${_Freetype_component_opt}") endif () unset(_Freetype_component_opt) -find_package(freetype CONFIG ${_Freetype_args}) +# Always find with QUIET to avoid noise when it is not found. +find_package(freetype CONFIG QUIET ${_Freetype_args}) unset(_Freetype_args) if (freetype_FOUND) if (NOT TARGET Freetype::Freetype) @@ -150,6 +147,14 @@ if (freetype_FOUND) set(Freetype_${_Freetype_component}_FOUND "${freetype_${_Freetype_component}_FOUND}") endforeach () unset(_Freetype_component) + + include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) + find_package_handle_standard_args( + Freetype + VERSION_VAR + FREETYPE_VERSION_STRING + ) + return () endif () -- cgit v0.12