vcpkg/ports/libxslt/fix-gcrypt-deps.patch
Kai Pastor 5a8ff0088a
[libxml2,libxslt] Revise dependency handling (#24935)
* Update mingw support expressions

* Update versions

* Use pkg-config for complete libgcrypt dependencies

* Remove crypto from default features

Align with CMake build system defaults.

* Drop unused liblzma dependency

* Update versions

* Skip installation of docs

* Update versions

* Restructure patches

* Update versions

* CI [skip actions]

* Revise libxml2 wrapper

* Omit CONFIG from find_package(LibXml2)

* Test libxml2 with, and fix for, CMake 3.7

* Update versions

* More libxml2 wrapper changes

* libxslt gcrypt variable name changes

* Install usage

* Trim portfile

* [openscap] Use vcpkg pkg-config database

* [openscap] Unbreak find_package(Threads)

* Update versions

* Update CI baseline

* REQUIRED is a literal

* Update versions

* Always load libxml2 config instead of find module [skip actions]

* [libxmlmm] Fix linking to libxml2

libxml2 needs iconv include dir on Windows.

* [libxmlmm] License field and processing

* [libxmlmm] Export unofficial CMake config

* [libxmlmm] Change target prefix, not global default

* Revert cmake-user changes

* Set LIBXML2_FOUND

* Update versions

* Fix xslt-config

* Update versions

* Adjust tidy-html5

* Update versions

Co-authored-by: Billy Robert O'Neal III <bion@microsoft.com>
2022-07-06 14:30:42 -07:00

46 lines
1.5 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6dc6501..d36a049 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -317,7 +317,9 @@ target_include_directories(
if(LIBXSLT_WITH_CRYPTO)
target_link_libraries(LibExslt PRIVATE Gcrypt::Gcrypt)
- set(LIBGCRYPT_LIBS "-lgcrypt")
+ # For libexslt.pc
+ set(LIBGCRYPT_LIBS "")
+ string(APPEND EXSLT_PRIVATE_REQUIRES " libgcrypt")
endif()
target_link_libraries(LibExslt PUBLIC LibXslt LibXml2::LibXml2)
diff --git a/FindGcrypt.cmake b/FindGcrypt.cmake
index 781113d..a78fa84 100644
--- a/FindGcrypt.cmake
+++ b/FindGcrypt.cmake
@@ -1,3 +1,20 @@
+cmake_policy(PUSH)
+cmake_policy(SET CMP0012 NEW)
+cmake_policy(SET CMP0057 NEW)
+find_package(PkgConfig)
+if("REQUIRED" IN_LIST ${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
+ pkg_check_modules(libxslt_gcrypt REQUIRED IMPORTED_TARGET libgcrypt)
+else()
+ pkg_check_modules(libxslt_gcrypt IMPORTED_TARGET libgcrypt)
+endif()
+set(Gcrypt_FOUND "${libxslt_gcrypt_FOUND}") # CMake standard, needed for find_dependency
+set(GCRYPT_FOUND "${libxslt_gcrypt_FOUND}") # libxslt usage
+if(libxslt_gcrypt_FOUND AND NOT TARGET Gcrypt::Gcrypt)
+ add_library(Gcrypt::Gcrypt INTERFACE IMPORTED)
+ set_target_properties(Gcrypt::Gcrypt PROPERTIES INTERFACE_LINK_LIBRARIES PkgConfig::libxslt_gcrypt)
+endif()
+cmake_policy(POP)
+if(0)
include(FindPackageHandleStandardArgs)
include(SelectLibraryConfigurations)
@@ -38,3 +53,4 @@ if(GCRYPT_FOUND AND NOT TARGET Gcrypt::Gcrypt)
INTERFACE_INCLUDE_DIRECTORIES "${GCRYPT_INCLUDE_DIRS}"
)
endif()
+endif()