diff --git a/CMakeLists.txt b/CMakeLists.txt index 295cff8e3..3259ca90c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,10 @@ option(HB_HAVE_FREETYPE "Enable freetype interop helpers" OFF) option(HB_HAVE_GRAPHITE2 "Enable Graphite2 complementary shaper" OFF) option(HB_HAVE_GLIB "Enable glib unicode functions" OFF) option(HB_HAVE_ICU "Enable icu unicode functions" OFF) +if (TARGET freetype) + set (HB_HAVE_FREETYPE ON) + add_definitions(-DHAVE_FREETYPE=1) +endif () if (APPLE) option(HB_HAVE_CORETEXT "Enable CoreText shaper backend on macOS" ON) set (CMAKE_MACOSX_RPATH ON) @@ -184,7 +188,7 @@ set (project_headers ${HB_BASE_headers}) set (subset_project_headers ${HB_SUBSET_headers}) ## Find and include needed header folders and libraries -if (HB_HAVE_FREETYPE) +if (HB_HAVE_FREETYPE AND NOT TARGET freetype) include (FindFreetype) if (NOT FREETYPE_FOUND) message(FATAL_ERROR "HB_HAVE_FREETYPE was set, but we failed to find it. Maybe add a CMAKE_PREFIX_PATH= to your Freetype2 install prefix") @@ -421,6 +425,10 @@ target_link_libraries(harfbuzz ${THIRD_PARTY_LIBS}) target_include_directories(harfbuzz PUBLIC "$" "$") +if (HB_HAVE_FREETYPE AND TARGET freetype) + target_link_libraries(harfbuzz PUBLIC freetype) +endif () + ## Define harfbuzz-icu library if (HB_HAVE_ICU)