vcpkg/ports/leptonica/fix-CMakeDependency.patch
LilyWangLL 821d0d20d7
[leptonica] Update to 1.82.0 and fix link 'openjp2.lib' failed (#23624)
* [leptonica] Fix find openjpeg

* update version

* update patch

* update version

* format portfile.cmake

* update version

* update patch

* update version

* format portfile.cmake

* update version

* update to 1.82.0

* update version

* update patches

* update version

* update patches

* update version

* Revise patching and configuration

* Update versions

* update patch

* update version

* update version

* update patch

* update version

Co-authored-by: Lily Wang <v-lilywang@microsoft.com>
Co-authored-by: Kai Pastor <dg0yt@darc.de>
2022-03-28 11:33:04 -07:00

65 lines
2.2 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d300da..fae4ca7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,8 +66,28 @@ if(NOT SW_BUILD)
find_package(PNG)
find_package(TIFF)
find_package(ZLIB)
- find_package(PkgConfig)
- if (PKG_CONFIG_FOUND)
+ find_package(WEBP NAMES WebP REQUIRED)
+ find_package(JP2K NAMES OpenJPEG REQUIRED)
+
+ set(GIF_LIBRARIES GIF::GIF)
+ set(JPEG_LIBRARIES JPEG::JPEG)
+ set(PNG_LIBRARIES PNG::PNG)
+ set(TIFF_LIBRARIES TIFF::TIFF)
+ set(ZLIB_LIBRARIES ZLIB::ZLIB)
+
+ set(JP2K "${JP2K_FOUND}")
+ set(JP2K_INCLUDE_DIRS "")
+ set(HAVE_LIBJP2K 1)
+ set(JP2K_LIBRARIES openjp2) # imported target
+
+ set(WEBP "${WEBP_FOUND}")
+ set(WEBP_INCLUDE_DIRS "")
+ set(WEBPMUX 1)
+ set(HAVE_LIBWEBP_ANIM 1)
+ set(WEBPMUX_FOUND TRUE)
+ set(WEBP_LIBRARIES WebP::libwebpmux WebP::webp)
+
+ if (0)
pkg_check_modules(WEBP libwebp QUIET)
pkg_check_modules(WEBPMUX libwebpmux>=${MINIMUM_WEBPMUX_VERSION} QUIET)
pkg_check_modules(JP2K libopenjp2>=2.0 QUIET)
diff --git a/cmake/templates/LeptonicaConfig.cmake.in b/cmake/templates/LeptonicaConfig.cmake.in
index 342c37d..506fb2a 100644
--- a/cmake/templates/LeptonicaConfig.cmake.in
+++ b/cmake/templates/LeptonicaConfig.cmake.in
@@ -19,6 +19,14 @@
# - Leptonica_VERSION_PATCH : Patch version part of Leptonica_VERSION: "@VERSION_PATCH@"
#
# ===================================================================================
+include(CMakeFindDependencyMacro)
+find_dependency(JPEG)
+find_dependency(ZLIB)
+find_dependency(PNG)
+find_dependency(TIFF)
+find_dependency(GIF)
+find_dependency(WebP)
+find_dependency(OpenJPEG)
include(${CMAKE_CURRENT_LIST_DIR}/LeptonicaTargets.cmake)
@@ -36,7 +44,8 @@ SET(Leptonica_VERSION_PATCH @VERSION_PATCH@)
# ======================================================
# Provide the include directories to the caller
-set(Leptonica_INCLUDE_DIRS "@INCLUDE_DIR@")
+get_filename_component(Leptonica_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../include" ABSOLUTE)
+list(APPEND Leptonica_INCLUDE_DIRS "${Leptonica_INCLUDE_DIRS}/leptonica")
# ====================================================================
# Link libraries: