CMake: Allow build with MinGW and Hunter 3rd party packages
Hunter has recently added aliased target names that conform with upstream CMake find module target names. Extended the WrapFreetype to work with Hunter's freetype (lowercase) package name. Change-Id: I0e25f342c6930658f07f05d2e6a58cf94d2d168d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
bb52bd49e1
commit
fae5691c7f
@ -6,7 +6,14 @@ if(TARGET WrapFreetype::WrapFreetype)
|
||||
endif()
|
||||
|
||||
set(WrapFreetype_FOUND OFF)
|
||||
find_package(Freetype)
|
||||
|
||||
# Hunter has the package named freetype, but exports the Freetype::Freetype target as upstream
|
||||
# First try the CONFIG package, and afterwards the MODULE if not found
|
||||
|
||||
find_package(Freetype CONFIG NAMES Freetype freetype QUIET)
|
||||
if(NOT Freetype_FOUND)
|
||||
find_package(Freetype MODULE)
|
||||
endif()
|
||||
|
||||
if(Freetype_FOUND)
|
||||
# vcpkg defines a lower case target name, while upstream Find module defines a prefixed
|
||||
|
@ -2036,6 +2036,12 @@ macro(qt_find_package)
|
||||
# all scopes.
|
||||
foreach(qt_find_package_target_name ${arg_PROVIDED_TARGETS})
|
||||
if(TARGET ${qt_find_package_target_name})
|
||||
# Allow usage of aliased targets by setting properties on the actual target
|
||||
get_target_property(aliased_target ${qt_find_package_target_name} ALIASED_TARGET)
|
||||
if(aliased_target)
|
||||
set(qt_find_package_target_name ${aliased_target})
|
||||
endif()
|
||||
|
||||
set_target_properties(${qt_find_package_target_name}
|
||||
PROPERTIES INTERFACE_QT_PACKAGE_NAME ${ARGV0})
|
||||
if(package_version)
|
||||
|
Loading…
x
Reference in New Issue
Block a user