diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2022-06-09 17:37:34 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2022-06-10 14:25:45 +0200 |
commit | f318c0e2d68ec0a3a98de43fcbaf51f84d5eb8a6 (patch) | |
tree | 4bc52df37cfc13737bd3e6e3b05a50955f5de2ce /cmake | |
parent | 71a0b893fb4beb15df4a6bfe540518e5267fdb40 (diff) | |
download | qtbase-f318c0e2d68ec0a3a98de43fcbaf51f84d5eb8a6.tar.gz |
CMake: Find system harfbuzz even if pkg-config is disabled
FindWrapSystemHarfbuzz.cmake relied on pkg-config to find system
harfbuzz. This patch makes it find system harfbuzz even if pkg-config
is not available or disabled.
Pick-to: 6.2 6.3 6.4
Task-number: QTBUG-103894
Change-Id: I2a8fc64c738c7604f47de89f387002e40a9fa5e0
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindWrapSystemHarfbuzz.cmake | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/cmake/FindWrapSystemHarfbuzz.cmake b/cmake/FindWrapSystemHarfbuzz.cmake index 170b6f3b22..fc6233d942 100644 --- a/cmake/FindWrapSystemHarfbuzz.cmake +++ b/cmake/FindWrapSystemHarfbuzz.cmake @@ -28,23 +28,38 @@ if(harfbuzz_FOUND AND TARGET "${__harfbuzz_target_name}") endif() if(__harfbuzz_broken_config_file OR NOT __harfbuzz_found) - list(PREPEND WrapSystemHarfbuzz_REQUIRED_VARS HARFBUZZ_LIBRARIES HARFBUZZ_INCLUDE_DIRS) - find_package(PkgConfig QUIET) pkg_check_modules(PC_HARFBUZZ harfbuzz IMPORTED_TARGET) if(PC_HARFBUZZ_FOUND) - find_path(HARFBUZZ_INCLUDE_DIRS - NAMES harfbuzz/hb.h + set(__harfbuzz_target_name "PkgConfig::PC_HARFBUZZ") + set(__harfbuzz_find_include_dirs_hints HINTS ${PC_HARFBUZZ_INCLUDEDIR}) - find_library(HARFBUZZ_LIBRARIES - NAMES harfbuzz + set(__harfbuzz_find_library_hints HINTS ${PC_HARFBUZZ_LIBDIR}) - - set(__harfbuzz_target_name "PkgConfig::PC_HARFBUZZ") - set(__harfbuzz_found TRUE) if(PC_HARFBUZZ_VERSION) set(WrapSystemHarfbuzz_VERSION "${PC_HARFBUZZ_VERSION}") endif() + else() + set(__harfbuzz_target_name "Harfbuzz::Harfbuzz") + endif() + + find_path(HARFBUZZ_INCLUDE_DIRS + NAMES harfbuzz/hb.h + ${__harfbuzz_find_include_dirs_hints}) + find_library(HARFBUZZ_LIBRARIES + NAMES harfbuzz + ${__harfbuzz_find_library_hints}) + + if(HARFBUZZ_INCLUDE_DIRS AND HARFBUZZ_LIBRARIES) + set(__harfbuzz_found TRUE) + if(NOT PC_HARFBUZZ_FOUND) + add_library(${__harfbuzz_target_name} UNKNOWN IMPORTED) + list(TRANSFORM HARFBUZZ_INCLUDE_DIRS APPEND "/harfbuzz") + set_target_properties(${__harfbuzz_target_name} PROPERTIES + IMPORTED_LOCATION "${HARFBUZZ_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${HARFBUZZ_INCLUDE_DIRS}" + ) + endif() endif() endif() @@ -58,6 +73,8 @@ if(WrapSystemHarfbuzz_FOUND) INTERFACE "${__harfbuzz_target_name}") endif() unset(__harfbuzz_target_name) +unset(__harfbuzz_find_include_dirs_hints) +unset(__harfbuzz_find_library_hints) unset(__harfbuzz_found) unset(__harfbuzz_include_dir) unset(__harfbuzz_broken_config_file) |