Merge topic 'Find-CONFIG-chain-fixes' into release-3.28

581acbce52 FindTIFF: consider `IMPLIB`-using platforms
e8e7d9f775 FindTIFF: always find the config module quietly
a575bebf0d FindFreetype: also consider RelWithDebInfo-built libraries
d892dedf22 FindFreetype: always find the config module quietly

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9068
This commit is contained in:
Brad King
2023-12-14 13:28:05 +00:00
committed by Kitware Robot
2 changed files with 99 additions and 14 deletions

View File

@@ -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)
@@ -113,6 +110,9 @@ if (freetype_FOUND)
get_property(_Freetype_location TARGET freetype PROPERTY IMPORTED_IMPLIB)
if (NOT _Freetype_location)
get_property(_Freetype_location_release TARGET freetype PROPERTY IMPORTED_IMPLIB_RELEASE)
if (NOT _Freetype_location_release)
get_property(_Freetype_location_release TARGET freetype PROPERTY IMPORTED_IMPLIB_RELWITHDEBINFO)
endif ()
get_property(_Freetype_location_debug TARGET freetype PROPERTY IMPORTED_IMPLIB_DEBUG)
if (_Freetype_location_release AND _Freetype_location_debug)
set(_Freetype_location
@@ -124,6 +124,9 @@ if (freetype_FOUND)
set(_Freetype_location "${_Freetype_location_debug}")
else ()
get_property(_Freetype_location_release TARGET freetype PROPERTY LOCATION_RELEASE)
if (NOT _Freetype_location_release)
get_property(_Freetype_location_release TARGET freetype PROPERTY LOCATION_RELWITHDEBINFO)
endif ()
get_property(_Freetype_location_debug TARGET freetype PROPERTY LOCATION_DEBUG)
if (_Freetype_location_release AND _Freetype_location_debug)
set(_Freetype_location
@@ -150,6 +153,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 ()

View File

@@ -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)
@@ -110,15 +107,86 @@ if (tiff_FOUND)
endif ()
get_property(TIFF_INCLUDE_DIRS TARGET TIFF::tiff PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(TIFF_LIBRARIES TARGET TIFF::tiff PROPERTY INTERFACE_LINK_LIBRARIES)
get_property(_TIFF_location TARGET TIFF::tiff PROPERTY LOCATION)
list(APPEND TIFF_LIBRARIES
get_property(_TIFF_location TARGET TIFF::tiff PROPERTY IMPORTED_IMPLIB)
if (NOT _TIFF_location)
get_property(_TIFF_location_release TARGET TIFF::tiff PROPERTY IMPORTED_IMPLIB_RELEASE)
if (NOT _TIFF_location_release)
get_property(_TIFF_location_release TARGET TIFF::tiff PROPERTY IMPORTED_IMPLIB_RELWITHDEBINFO)
endif ()
get_property(_TIFF_location_debug TARGET TIFF::tiff PROPERTY IMPORTED_IMPLIB_DEBUG)
if (_TIFF_location_release AND _TIFF_location_debug)
set(_TIFF_location
optimized "${_TIFF_location_release}"
debug "${_TIFF_location_debug}")
elseif (_TIFF_location_release)
set(_TIFF_location "${_TIFF_location_release}")
elseif (_TIFF_location_debug)
set(_TIFF_location "${_TIFF_location_debug}")
else ()
get_property(_TIFF_location_release TARGET TIFF::tiff PROPERTY LOCATION_RELEASE)
if (NOT _TIFF_location_release)
get_property(_TIFF_location_release TARGET TIFF::tiff PROPERTY LOCATION_RELWITHDEBINFO)
endif ()
get_property(_TIFF_location_debug TARGET TIFF::tiff PROPERTY LOCATION_DEBUG)
if (_TIFF_location_release AND _TIFF_location_debug)
set(_TIFF_location
optimized "${_TIFF_location_release}"
debug "${_TIFF_location_debug}")
elseif (_TIFF_location_release)
set(_TIFF_location "${_TIFF_location_release}")
elseif (_TIFF_location_debug)
set(_TIFF_location "${_TIFF_location_debug}")
else ()
get_property(_TIFF_location TARGET TIFF::tiff PROPERTY LOCATION)
endif ()
endif ()
unset(_TIFF_location_release)
unset(_TIFF_location_debug)
endif ()
list(INSERT TIFF_LIBRARIES 0
"${_TIFF_location}")
unset(_TIFF_location)
set(TIFF_FOUND 1)
if("CXX" IN_LIST TIFF_FIND_COMPONENTS)
if (TARGET TIFF::CXX)
get_property(_TIFF_CXX_location TARGET TIFF::CXX PROPERTY LOCATION)
list(APPEND TIFF_LIBRARIES ${_TIFF_CXX_location})
get_property(_TIFF_CXX_location TARGET TIFF::CXX PROPERTY IMPORTED_IMPLIB)
if (NOT _TIFF_CXX_location)
get_property(_TIFF_CXX_location_release TARGET TIFF::CXX PROPERTY IMPORTED_IMPLIB_RELEASE)
if (NOT _TIFF_CXX_location_release)
get_property(_TIFF_CXX_location_release TARGET TIFF::CXX PROPERTY IMPORTED_IMPLIB_RELWITHDEBINFO)
endif ()
get_property(_TIFF_CXX_location_debug TARGET TIFF::CXX PROPERTY IMPORTED_IMPLIB_DEBUG)
if (_TIFF_CXX_location_release AND _TIFF_CXX_location_debug)
set(_TIFF_CXX_location
optimized "${_TIFF_CXX_location_release}"
debug "${_TIFF_CXX_location_debug}")
elseif (_TIFF_CXX_location_release)
set(_TIFF_CXX_location "${_TIFF_CXX_location_release}")
elseif (_TIFF_CXX_location_debug)
set(_TIFF_CXX_location "${_TIFF_CXX_location_debug}")
else ()
get_property(_TIFF_CXX_location_release TARGET TIFF::CXX PROPERTY LOCATION_RELEASE)
if (NOT _TIFF_CXX_location_release)
get_property(_TIFF_CXX_location_release TARGET TIFF::CXX PROPERTY LOCATION_RELWITHDEBINFO)
endif ()
get_property(_TIFF_CXX_location_debug TARGET TIFF::CXX PROPERTY LOCATION_DEBUG)
if (_TIFF_CXX_location_release AND _TIFF_CXX_location_debug)
set(_TIFF_CXX_location
optimized "${_TIFF_CXX_location_release}"
debug "${_TIFF_CXX_location_debug}")
elseif (_TIFF_CXX_location_release)
set(_TIFF_CXX_location "${_TIFF_CXX_location_release}")
elseif (_TIFF_CXX_location_debug)
set(_TIFF_CXX_location "${_TIFF_CXX_location_debug}")
else ()
get_property(_TIFF_CXX_location TARGET TIFF::CXX PROPERTY LOCATION)
endif ()
endif ()
unset(_TIFF_CXX_location_release)
unset(_TIFF_CXX_location_debug)
endif ()
list(INSERT TIFF_LIBRARIES 0
"${_TIFF_CXX_location}")
unset(_TIFF_CXX_location)
set(TIFF_CXX_FOUND 1)
else ()
@@ -135,6 +203,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 ()