From 388d219f256b75452c088b4cc2e16fd38f7f6995 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 7 Jun 2019 22:36:25 +0200 Subject: [PATCH] Fix freetype cmake config files (#6754) The way of including freetype headers is by using #include #include FT_FREETYPE_H along with $root/include/freetype which has $root/include/freetype/ft2build.h and then the rest of the headers under $root/include/freetype/freetype2/*.h. The portfile.cmake moves the headers one directory up into $root/include so that there's $root/include/ft2build.h and the rest of the headers under $root/include/freetype/. This in turn means that the above way of including header files requires $root/include to be in the include search path. That's not the case by default and the generated freetype-config.cmake also doesn't include that. Therefore the freetype config approach results in failing builds when applications wants to use it. This is easy to reproduce using find_package(Freetype CONFIG REQUIRED) ... target_link_libraries(foo PRIVATE freetype) As a remedy, this patch fixes the freetype-config.cmake file to add $root/include in the include search path. --- ports/freetype/CONTROL | 2 +- ports/freetype/portfile.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/freetype/CONTROL b/ports/freetype/CONTROL index 7e18d1a7ce..15c9caffd1 100644 --- a/ports/freetype/CONTROL +++ b/ports/freetype/CONTROL @@ -1,4 +1,4 @@ Source: freetype -Version: 2.9.1-1 +Version: 2.9.1-2 Build-Depends: zlib, bzip2, libpng Description: A library to render fonts. diff --git a/ports/freetype/portfile.cmake b/ports/freetype/portfile.cmake index 73cb6b3172..654cff2b9f 100644 --- a/ports/freetype/portfile.cmake +++ b/ports/freetype/portfile.cmake @@ -70,7 +70,7 @@ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") else() #if(VCPKG_BUILD_TYPE STREQUAL "release") file(READ ${CURRENT_PACKAGES_DIR}/share/freetype/freetype-config.cmake CONFIG_MODULE) endif() -string(REPLACE "\${_IMPORT_PREFIX}/include/freetype2" "\${_IMPORT_PREFIX}/include/freetype" CONFIG_MODULE "${CONFIG_MODULE}") +string(REPLACE "\${_IMPORT_PREFIX}/include/freetype2" "\${_IMPORT_PREFIX}/include;\${_IMPORT_PREFIX}/include/freetype" CONFIG_MODULE "${CONFIG_MODULE}") file(WRITE ${CURRENT_PACKAGES_DIR}/share/freetype/freetype-config.cmake "${CONFIG_MODULE}") file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)