From 885d87488ade83b37519a3b08cd968dc76a661c2 Mon Sep 17 00:00:00 2001 From: Amir Masoud Abdol Date: Mon, 16 Oct 2023 15:29:36 +0200 Subject: [PATCH] Make sure that pkgconf can find HarfBuzz pkgconf is an alternative implementation of pkg-config, and it is mostly compatible with pkg-config, but in the case of HarfBuzz, it adds the `/usr/local/include` to `INTERFACE_INCLUDE_DIRECTORIES` when reports the include path, and if the path doesn't exist, the configuration fails. In the case of HarfBuzz, we do some extra work to make sure that we can always find the library, so, with a bit of modification, we can skip the faulty pkgconf intervention and create the correct imported target. Fixes: QTBUG-117905 Change-Id: Id628e4434633534b0d7bfad9e819a8c05da4944d Reviewed-by: Alexey Edelev Reviewed-by: Alexandru Croitor --- cmake/FindWrapSystemHarfbuzz.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/FindWrapSystemHarfbuzz.cmake b/cmake/FindWrapSystemHarfbuzz.cmake index 07b3405bc07..9651c56a95b 100644 --- a/cmake/FindWrapSystemHarfbuzz.cmake +++ b/cmake/FindWrapSystemHarfbuzz.cmake @@ -32,8 +32,12 @@ endif() if(__harfbuzz_broken_config_file OR NOT __harfbuzz_found) find_package(PkgConfig QUIET) + if(PKG_CONFIG_EXECUTABLE MATCHES "pkgconf") + # pkgconf is an alternative implementation of pkg-config + set(pkgconf_is_used TRUE) + endif() pkg_check_modules(PC_HARFBUZZ IMPORTED_TARGET "harfbuzz") - if(PC_HARFBUZZ_FOUND) + if(PC_HARFBUZZ_FOUND AND NOT pkgconf_is_used) set(__harfbuzz_target_name "PkgConfig::PC_HARFBUZZ") set(__harfbuzz_find_include_dirs_hints HINTS ${PC_HARFBUZZ_INCLUDEDIR}) @@ -55,7 +59,7 @@ if(__harfbuzz_broken_config_file OR NOT __harfbuzz_found) if(HARFBUZZ_INCLUDE_DIRS AND HARFBUZZ_LIBRARIES) set(__harfbuzz_found TRUE) - if(NOT PC_HARFBUZZ_FOUND) + if(NOT PC_HARFBUZZ_FOUND OR pkgconf_is_used) add_library(${__harfbuzz_target_name} UNKNOWN IMPORTED) list(TRANSFORM HARFBUZZ_INCLUDE_DIRS APPEND "/harfbuzz") set_target_properties(${__harfbuzz_target_name} PROPERTIES