>From f87f9ed99129db26c6dcad6677bd417bcf1c82af Mon Sep 17 00:00:00 2001 From: Nikolaus Waxweiler
Date: Sat, 7 Apr 2018 21:35:10 +0100 Subject: [PATCH 02/19] Update FindHarfBuzz.cmake: Do not look for and link against icu library --- builds/cmake/FindHarfBuzz.cmake | 45 +++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/builds/cmake/FindHarfBuzz.cmake b/builds/cmake/FindHarfBuzz.cmake index f394b82bf..c8444d325 100644 --- a/builds/cmake/FindHarfBuzz.cmake +++ b/builds/cmake/FindHarfBuzz.cmake @@ -31,42 +31,39 @@ # HARFBUZZ_LIBRARIES - containg the HarfBuzz library include(FindPkgConfig) +pkg_check_modules(PC_HARFBUZZ QUIET harfbuzz) -pkg_check_modules(PC_HARFBUZZ harfbuzz>=0.9.7) - -find_path(HARFBUZZ_INCLUDE_DIRS NAMES hb.h - HINTS ${PC_HARFBUZZ_INCLUDE_DIRS} ${PC_HARFBUZZ_INCLUDEDIR} +find_path(HARFBUZZ_INCLUDE_DIRS + NAMES hb.h + HINTS ${PC_HARFBUZZ_INCLUDEDIR} + ${PC_HARFBUZZ_INCLUDE_DIRS} + PATH_SUFFIXES harfbuzz ) find_library(HARFBUZZ_LIBRARIES NAMES harfbuzz - HINTS ${PC_HARFBUZZ_LIBRARY_DIRS} ${PC_HARFBUZZ_LIBDIR} + HINTS ${PC_HARFBUZZ_LIBDIR} + ${PC_HARFBUZZ_LIBRARY_DIRS} ) -# HarfBuzz 0.9.18 split ICU support into a separate harfbuzz-icu library. -if ("${PC_HARFBUZZ_VERSION}" VERSION_GREATER "0.9.17") - if (HarfBuzz_FIND_REQUIRED) - set(_HARFBUZZ_REQUIRED REQUIRED) - else () - set(_HARFBUZZ_REQUIRED "") - endif () - pkg_check_modules(PC_HARFBUZZ_ICU harfbuzz-icu>=0.9.18 ${_HARFBUZZ_REQUIRED}) - find_library(HARFBUZZ_ICU_LIBRARIES NAMES harfbuzz-icu - HINTS ${PC_HARFBUZZ_ICU_LIBRARY_DIRS} ${PC_HARFBUZZ_ICU_LIBDIR} - ) - if (HARFBUZZ_ICU_LIBRARIES) - list(APPEND HARFBUZZ_LIBRARIES "${HARFBUZZ_ICU_LIBRARIES}") +if (HARFBUZZ_INCLUDE_DIRS) + if (EXISTS "${HARFBUZZ_INCLUDE_DIRS}/hb-version.h") + file(READ "${HARFBUZZ_INCLUDE_DIRS}/hb-version.h" _harfbuzz_version_content) + + string(REGEX MATCH "#define +HB_VERSION_STRING +\"([0-9]+\\.[0-9]+\\.[0-9]+)\"" _dummy "${_harfbuzz_version_content}") + set(HARFBUZZ_VERSION "${CMAKE_MATCH_1}") endif () - set(_HARFBUZZ_EXTRA_REQUIRED_VAR "HARFBUZZ_ICU_LIBRARIES") -else () - set(_HARFBUZZ_EXTRA_REQUIRED_VAR "") +endif () + +if ("${Harfbuzz_FIND_VERSION}" VERSION_GREATER "${HARFBUZZ_VERSION}") + message(FATAL_ERROR "Required version (" ${Harfbuzz_FIND_VERSION} ") is higher than found version (" ${CAIRO_VERSION} ")") endif () include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(HarfBuzz DEFAULT_MSG HARFBUZZ_INCLUDE_DIRS - HARFBUZZ_LIBRARIES ${_HARFBUZZ_EXTRA_REQUIRED_VAR}) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Harfbuzz REQUIRED_VARS HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES + VERSION_VAR HARFBUZZ_VERSION) mark_as_advanced( - HARFBUZZ_ICU_LIBRARIES HARFBUZZ_INCLUDE_DIRS HARFBUZZ_LIBRARIES + HARFBUZZ_ICU_LIBRARIES ) -- 2.14.3