vcpkg/ports/libarchive/fix-dependencies.patch
Kai Pastor 0707a17ecf
[liblzma] No debug postfix. Rewrite wrapper. (#22856)
* Restore upstream's DLL name

* Don't add debug postfix

* Decouple wrapper from config

* Don't inject Find module stuff into config

* Cleanup

* [skip actions] Trim lzmad and LibLZMA patching

* [skip actions] Fix CMAKE_DISABLE_FIND_PACKAGE_LibLZMA

* [skip actions] CI

* Update manifests

* Update versions

* Backfill LibLZMA::LibLZMA to CMake < 3.14

* Update versions

* Update versions
2022-02-28 10:25:31 -08:00

129 lines
4.2 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 39b5333..8164d8f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -433,7 +433,7 @@ MARK_AS_ADVANCED(CLEAR ZLIB_LIBRARY)
# Find BZip2
#
IF(ENABLE_BZip2)
- FIND_PACKAGE(BZip2)
+ FIND_PACKAGE(BZip2 REQUIRED)
ELSE()
SET(BZIP2_FOUND FALSE) # Override cached value
ENDIF()
@@ -462,7 +462,8 @@ MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARIES)
# Find LZMA
#
IF(ENABLE_LZMA)
- FIND_PACKAGE(LibLZMA)
+ FIND_PACKAGE(LibLZMA REQUIRED)
+ SET(LIBLZMA_LIBRARIES LibLZMA::LibLZMA)
ELSE()
SET(LIBLZMA_FOUND FALSE) # Override cached value
ENDIF()
@@ -470,6 +471,8 @@ ENDIF()
IF(LIBLZMA_FOUND)
SET(HAVE_LIBLZMA 1)
SET(HAVE_LZMA_H 1)
+ LIST(APPEND ADDITIONAL_LIBS LibLZMA::LibLZMA)
+elseif(0)
CMAKE_PUSH_CHECK_STATE()
INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS})
LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES})
@@ -555,22 +558,15 @@ IF(ENABLE_LZ4)
SET(LZ4_FIND_QUIETLY TRUE)
ENDIF (LZ4_INCLUDE_DIR)
- FIND_PATH(LZ4_INCLUDE_DIR lz4.h)
- FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4)
- INCLUDE(FindPackageHandleStandardArgs)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR)
+ FIND_PACKAGE(lz4 CONFIG REQUIRED)
ELSE(ENABLE_LZ4)
SET(LZ4_FOUND FALSE) # Override cached value
ENDIF(ENABLE_LZ4)
-IF(LZ4_FOUND)
+IF(lz4_FOUND)
+ SET(HAVE_LZ4HC_H 1)
SET(HAVE_LIBLZ4 1)
SET(HAVE_LZ4_H 1)
- CMAKE_PUSH_CHECK_STATE() # Save the state of the variables
- SET(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR})
- CHECK_INCLUDE_FILES("lz4hc.h" HAVE_LZ4HC_H)
- CMAKE_POP_CHECK_STATE() # Restore the state of the variables
- INCLUDE_DIRECTORIES(${LZ4_INCLUDE_DIR})
- LIST(APPEND ADDITIONAL_LIBS ${LZ4_LIBRARY})
+ LIST(APPEND ADDITIONAL_LIBS lz4::lz4)
#
# TODO: test for static library.
#
@@ -586,25 +566,20 @@ IF(ENABLE_ZSTD)
SET(ZSTD_FIND_QUIETLY TRUE)
ENDIF (ZSTD_INCLUDE_DIR)
- FIND_PATH(ZSTD_INCLUDE_DIR zstd.h)
- FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd)
- INCLUDE(FindPackageHandleStandardArgs)
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
+ FIND_PACKAGE(zstd CONFIG REQUIRED)
ELSE(ENABLE_ZSTD)
SET(ZSTD_FOUND FALSE) # Override cached value
ENDIF(ENABLE_ZSTD)
-IF(ZSTD_FOUND)
+IF(zstd_FOUND)
SET(HAVE_ZSTD_H 1)
- INCLUDE_DIRECTORIES(${ZSTD_INCLUDE_DIR})
- LIST(APPEND ADDITIONAL_LIBS ${ZSTD_LIBRARY})
- CMAKE_PUSH_CHECK_STATE()
- SET(CMAKE_REQUIRED_LIBRARIES ${ZSTD_LIBRARY})
- SET(CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR})
- CHECK_FUNCTION_EXISTS(ZSTD_compressStream HAVE_LIBZSTD)
- #
- # TODO: test for static library.
- #
- CMAKE_POP_CHECK_STATE()
+ SET(HAVE_LIBZSTD 1)
+ IF(TARGET zstd::libzstd_shared)
+ LIST(APPEND ADDITIONAL_LIBS zstd::libzstd_shared)
+ SET(CMAKE_REQUIRED_LIBRARIES zstd::libzstd_shared)
+ ELSE(TARGET zstd::libzstd_shared)
+ LIST(APPEND ADDITIONAL_LIBS zstd::libzstd_static)
+ SET(CMAKE_REQUIRED_LIBRARIES zstd::libzstd_static)
+ ENDIF(TARGET zstd::libzstd_shared)
ENDIF(ZSTD_FOUND)
MARK_AS_ADVANCED(CLEAR ZSTD_INCLUDE_DIR)
MARK_AS_ADVANCED(CLEAR ZSTD_LIBRARY)
@@ -773,11 +742,11 @@ ENDIF(ENABLE_NETTLE)
# (Except on Mac, where OpenSSL is deprecated.)
#
IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
- FIND_PACKAGE(OpenSSL)
- IF(OPENSSL_FOUND)
+ FIND_PACKAGE(OpenSSL REQUIRED)
+ IF(OpenSSL_FOUND)
SET(HAVE_LIBCRYPTO 1)
- INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
- LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_CRYPTO_LIBRARY})
+ LIST(APPEND ADDITIONAL_LIBS OpenSSL::Crypto)
+ message("OPENSSL_CRYPTO_LIBRARY: OpenSSL::Crypto")
ENDIF(OPENSSL_FOUND)
ELSE()
SET(OPENSSL_FOUND FALSE) # Override cached value
@@ -896,7 +865,6 @@ main(int argc, char **argv)
IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES})
- LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS)
ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND)
ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION})
ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM})
@@ -1128,7 +1096,7 @@ ENDIF(ENABLE_ICONV)
# Find Libxml2
#
IF(ENABLE_LIBXML2)
- FIND_PACKAGE(LibXml2)
+ FIND_PACKAGE(LibXml2 REQUIRED)
ELSE()
SET(LIBXML2_FOUND FALSE)
ENDIF()