[freetype][harfbuzz] Fix static freetype dependency.

This commit is contained in:
Robert Schumacher 2018-01-18 10:45:34 -08:00
parent d35866018a
commit 353d635b97
4 changed files with 28 additions and 3 deletions

View File

@ -1,5 +1,4 @@
The package freetype is compatible with built-in CMake targets:
find_package(Freetype REQUIRED)
target_link_libraries(main PRIVATE ${FREETYPE_LIBRARIES})
target_include_directories(main PRIVATE ${FREETYPE_INCLUDE_DIRS})
target_link_libraries(main PRIVATE Freetype::Freetype)

View File

@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 24ccb6f..21df836 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -201,7 +201,7 @@ set(project_headers
## Find and include needed header folders and libraries
if (HB_HAVE_FREETYPE)
- include(FindFreetype)
+ find_package(Freetype REQUIRED)
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")
endif()

View File

@ -10,7 +10,9 @@ vcpkg_from_github(
vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES "${CMAKE_CURRENT_LIST_DIR}/0001-fix-uwp-build.patch"
PATCHES
"${CMAKE_CURRENT_LIST_DIR}/0001-fix-uwp-build.patch"
"${CMAKE_CURRENT_LIST_DIR}/find-package-freetype.patch"
)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")

View File

@ -206,6 +206,17 @@ macro(find_package name)
if(TIFF_LIBRARIES)
list(APPEND TIFF_LIBRARIES ${LIBLZMA_LIBRARIES})
endif()
elseif("${name}" STREQUAL "Freetype")
_find_package(${ARGV})
find_package(ZLIB)
find_package(PNG)
find_package(BZip2)
if(TARGET Freetype::Freetype)
set_property(TARGET Freetype::Freetype APPEND PROPERTY INTERFACE_LINK_LIBRARIES BZip2::BZip2 PNG::PNG ZLIB::ZLIB)
endif()
if(FREETYPE_LIBRARIES)
list(APPEND FREETYPE_LIBRARIES ${BZIP2_LIBRARIES} ${PNG_LIBRARIES} ${ZLIB_LIBRARIES})
endif()
elseif("${name}" STREQUAL "tinyxml2")
_find_package(${ARGV})
if(TARGET tinyxml2_static AND NOT TARGET tinyxml2)