diff --git a/ports/fontconfig/CONTROL b/ports/fontconfig/CONTROL index d02960b620..4b455e985c 100644 --- a/ports/fontconfig/CONTROL +++ b/ports/fontconfig/CONTROL @@ -1,6 +1,6 @@ Source: fontconfig Version: 2.13.1 -Port-Version: 2 +Port-Version: 3 Homepage: https://www.freedesktop.org/software/fontconfig/front.html Description: Library for configuring and customizing font access. Build-Depends: freetype, expat, libiconv, dirent, pthread, json-c, dirent, libuuid (!windows&!osx), gettext \ No newline at end of file diff --git a/ports/fontconfig/portfile.cmake b/ports/fontconfig/portfile.cmake index cf840dd122..d50ff6392d 100644 --- a/ports/fontconfig/portfile.cmake +++ b/ports/fontconfig/portfile.cmake @@ -45,7 +45,7 @@ vcpkg_configure_make( vcpkg_install_make(ADD_BIN_TO_PATH) vcpkg_copy_pdbs() -vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES uuid) +vcpkg_fixup_pkgconfig() # Fix paths in debug pc file. set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/fontconfig.pc") @@ -98,4 +98,9 @@ endif() if(VCPKG_TARGET_IS_WINDOWS) # Unnecessary make rule creating the fontconfig cache dir on windows. file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}LOCAL_APPDATA_FONTCONFIG_CACHE") -endif() \ No newline at end of file +endif() + +if(NOT VCPKG_TARGET_IS_LINUX) + set(VCPKG_TARGET_IS_LINUX 0) # To not leave empty AND statements in the wrapper +endif() +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY) diff --git a/ports/fontconfig/vcpkg-cmake-wrapper.cmake.in b/ports/fontconfig/vcpkg-cmake-wrapper.cmake.in new file mode 100644 index 0000000000..ab2b5679b6 --- /dev/null +++ b/ports/fontconfig/vcpkg-cmake-wrapper.cmake.in @@ -0,0 +1,46 @@ +_find_package(${ARGS}) +if(Fontconfig_FOUND) # theoretically this could be skipped. If the wrapper is installed it should be found! + find_package(Freetype) + if(Freetype_FOUND AND TARGET Fontconfig::Fontconfig) + if(TARGET Freetype::Freetype) + set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "Freetype::Freetype") + else() + # TODO link Freetype libraries to the target if the target Freetype::Freetype is not defined; + endif() + endif() + if(FREETYPE_LIBRARIES) + list(APPEND Fontconfig_LIBRARIES "${FREETYPE_LIBRARIES}") + endif() + find_package(EXPAT) + if(EXPAT_FOUND AND TARGET Fontconfig::Fontconfig) + set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "EXPAT::EXPAT") + endif() + if(EXPAT_LIBRARIES) + list(APPEND Fontconfig_LIBRARIES "${EXPAT_LIBRARIES}") + endif() + include(SelectLibraryConfigurations) + find_library(Fontconfig_LIBRARY_DEBUG NAMES fontconfig fontconfigd NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_INSTALLED_DIR}/debug" NO_DEFAULT_PATH) + find_library(Fontconfig_LIBRARY_RELEASE NAMES fontconfig NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH) + select_library_configurations(Fontconfig) + if(@VCPKG_TARGET_IS_LINUX@) + find_library(UUID_LIBRARY_DEBUG NAMES uuid uuidd uuid_d NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_INSTALLED_DIR}/debug" NO_DEFAULT_PATH) + find_library(UUID_LIBRARY_RELEASE NAMES uuid NAMES_PER_DIR PATH_SUFFIXES lib PATHS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" NO_DEFAULT_PATH) + select_library_configurations(UUID) + endif() + if(Fontconfig_LIBRARY_DEBUG AND TARGET Fontconfig::Fontconfig) + set_target_properties(Fontconfig::Fontconfig PROPERTIES IMPORTED_LOCATION_DEBUG "${Fontconfig_LIBRARY_DEBUG}") + if(UUID_LIBRARY_DEBUG AND @VCPKG_TARGET_IS_LINUX@) + set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$<$:${UUID_LIBRARY_DEBUG}>") + endif() + endif() + if(Fontconfig_LIBRARY_RELEASE AND TARGET Fontconfig::Fontconfig) + set_target_properties(Fontconfig::Fontconfig PROPERTIES IMPORTED_LOCATION_RELEASE "${Fontconfig_LIBRARY_RELEASE}") + if(UUID_LIBRARY_RELEASE AND @VCPKG_TARGET_IS_LINUX@) + set_property(TARGET Fontconfig::Fontconfig APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$<$>:${UUID_LIBRARY_RELEASE}>") + endif() + endif() + + if(UUID_LIBRARIES AND @VCPKG_TARGET_IS_LINUX@) + list(APPEND Fontconfig_LIBRARIES "${UUID_LIBRARIES}") + endif() +endif()