diff options
author | Brad King <brad.king@kitware.com> | 2019-03-12 17:54:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-03-13 14:47:21 (GMT) |
commit | 1761a9a54668da90c61f47afbb4e520a7079a697 (patch) | |
tree | 8dd0721ed2f025c05c1ab46e0c16d7ffcf23bf37 /Utilities | |
parent | 2cf29217492a951ee40c17f855faa48aa26098f8 (diff) | |
download | CMake-1761a9a54668da90c61f47afbb4e520a7079a697.zip CMake-1761a9a54668da90c61f47afbb4e520a7079a697.tar.gz CMake-1761a9a54668da90c61f47afbb4e520a7079a697.tar.bz2 |
CMake: Enable use of zstd in libarchive
Build zstd as part of CMake or find one on the system. Modify our
port of libarchive to use the zstd configured for use with CMake.
Issue: #18657
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/cmThirdParty.h.in | 1 | ||||
-rw-r--r-- | Utilities/cm_zstd.h | 14 | ||||
-rw-r--r-- | Utilities/cmlibarchive/CMakeLists.txt | 6 | ||||
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c | 2 | ||||
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_version_details.c | 2 | ||||
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c | 2 |
6 files changed, 20 insertions, 7 deletions
diff --git a/Utilities/cmThirdParty.h.in b/Utilities/cmThirdParty.h.in index 46e0490..1456e34 100644 --- a/Utilities/cmThirdParty.h.in +++ b/Utilities/cmThirdParty.h.in @@ -15,5 +15,6 @@ #cmakedefine CMAKE_USE_SYSTEM_JSONCPP #cmakedefine CMAKE_USE_SYSTEM_LIBRHASH #cmakedefine CMAKE_USE_SYSTEM_LIBUV +#cmakedefine CMAKE_USE_SYSTEM_ZSTD #endif diff --git a/Utilities/cm_zstd.h b/Utilities/cm_zstd.h new file mode 100644 index 0000000..4bda996 --- /dev/null +++ b/Utilities/cm_zstd.h @@ -0,0 +1,14 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#ifndef cm_zstd_h +#define cm_zstd_h + +/* Use the libzstd configured for CMake. */ +#include "cmThirdParty.h" +#ifdef CMAKE_USE_SYSTEM_ZSTD +# include <zstd.h> +#else +# include <cmzstd/lib/zstd.h> +#endif + +#endif diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index 53b3a83..60c8316 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -376,6 +376,7 @@ IF(LZ4_FOUND) ENDIF(LZ4_FOUND) MARK_AS_ADVANCED(CLEAR LZ4_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR LZ4_LIBRARY) +ENDIF() # # Find Zstd # @@ -392,16 +393,13 @@ IF(ZSTD_FOUND) SET(HAVE_ZSTD_H 1) INCLUDE_DIRECTORIES(${ZSTD_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${ZSTD_LIBRARY}) - SET(CMAKE_REQUIRED_LIBRARIES ${ZSTD_LIBRARY}) - SET(CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR}) - CHECK_FUNCTION_EXISTS(ZSTD_compressStream HAVE_LIBZSTD) + SET(HAVE_LIBZSTD 1) # # TODO: test for static library. # ENDIF(ZSTD_FOUND) MARK_AS_ADVANCED(CLEAR ZSTD_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR ZSTD_LIBRARY) -ENDIF() # # Check headers diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c index c8bb36b..4513706 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_filter_zstd.c @@ -45,7 +45,7 @@ __FBSDID("$FreeBSD$"); #include <unistd.h> #endif #if HAVE_ZSTD_H -#include <zstd.h> +#include <cm_zstd.h> #endif #include "archive.h" diff --git a/Utilities/cmlibarchive/libarchive/archive_version_details.c b/Utilities/cmlibarchive/libarchive/archive_version_details.c index e773e5e..b9af6d7 100644 --- a/Utilities/cmlibarchive/libarchive/archive_version_details.c +++ b/Utilities/cmlibarchive/libarchive/archive_version_details.c @@ -46,7 +46,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_util.c 201098 2009-12-28 02:58:1 #include <lz4.h> #endif #ifdef HAVE_ZSTD_H -#include <zstd.h> +#include <cm_zstd.h> #endif #include "archive.h" diff --git a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c index 671fc6a..251b17d 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_add_filter_zstd.c @@ -38,7 +38,7 @@ __FBSDID("$FreeBSD$"); #include <string.h> #endif #ifdef HAVE_ZSTD_H -#include <zstd.h> +#include <cm_zstd.h> #endif #include "archive.h" |