diff options
author | Brad King <brad.king@kitware.com> | 2020-02-13 15:11:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-02-13 17:59:29 (GMT) |
commit | b83d96f164f158fd4d72ae8f67c1311a9bebd272 (patch) | |
tree | fe99813d44903987c015ed178a2a19a6a331d8f5 | |
parent | 5d8b3aec0cb8652ae867ff08d2e7bfa2060138dd (diff) | |
download | CMake-b83d96f164f158fd4d72ae8f67c1311a9bebd272.zip CMake-b83d96f164f158fd4d72ae8f67c1311a9bebd272.tar.gz CMake-b83d96f164f158fd4d72ae8f67c1311a9bebd272.tar.bz2 |
libarchive: Update to build within CMake
Hard-code more libarchive options as internal cache entries. Doing so
makes some of our `IF(0)` conditions unnecessary, so remove those.
-rw-r--r-- | CMakeLists.txt | 6 | ||||
-rw-r--r-- | Source/cm_get_date.c | 4 | ||||
-rw-r--r-- | Utilities/cmlibarchive/CMakeLists.txt | 27 | ||||
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_getdate.c | 2 | ||||
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c | 2 |
5 files changed, 18 insertions, 23 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c7d139b..88dacdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -547,21 +547,25 @@ macro (CMAKE_BUILD_UTILITIES) set(ZLIB_INCLUDE_DIR ${CMAKE_ZLIB_INCLUDES}) set(ZLIB_LIBRARY ${CMAKE_ZLIB_LIBRARIES}) add_definitions(-DLIBARCHIVE_STATIC) + set(ENABLE_MBEDTLS OFF CACHE INTERNAL "Enable use of mbed TLS") set(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle") set(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL") + set(ENABLE_LIBB2 OFF CACHE INTERNAL "Enable the use of the system LIBB2 library if found") set(ENABLE_LZMA ON CACHE INTERNAL "Enable the use of the system LZMA library if found") set(ENABLE_LZ4 OFF CACHE INTERNAL "Enable the use of the system LZ4 library if found") set(ENABLE_LZO OFF CACHE INTERNAL "Enable the use of the system LZO library if found") set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system ZLIB library if found") set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system BZip2 library if found") + set(ENABLE_ZSTD ON CACHE INTERNAL "Enable the use of the system zstd library if found") set(ENABLE_LIBXML2 OFF CACHE INTERNAL "Enable the use of the system libxml2 library if found") - set(ENABLE_EXPAT ON CACHE INTERNAL "Enable the use of the system EXPAT library if found") + set(ENABLE_EXPAT OFF CACHE INTERNAL "Enable the use of the system EXPAT library if found") set(ENABLE_PCREPOSIX OFF CACHE INTERNAL "Enable the use of the system PCREPOSIX library if found") set(ENABLE_LibGCC OFF CACHE INTERNAL "Enable the use of the system LibGCC library if found") set(ENABLE_XATTR OFF CACHE INTERNAL "Enable extended attribute support") set(ENABLE_ACL OFF CACHE INTERNAL "Enable ACL support") set(ENABLE_ICONV OFF CACHE INTERNAL "Enable iconv support") set(ENABLE_CNG OFF CACHE INTERNAL "Enable the use of CNG(Crypto Next Generation)") + SET(POSIX_REGEX_LIB "" CACHE INTERNAL "Choose what library should provide POSIX regular expression support") add_subdirectory(Utilities/cmlibarchive) CMAKE_SET_TARGET_FOLDER(cmlibarchive "Utilities/3rdParty") set(CMAKE_TAR_LIBRARIES cmlibarchive ${BZIP2_LIBRARIES}) diff --git a/Source/cm_get_date.c b/Source/cm_get_date.c index 4bef803..49f5577 100644 --- a/Source/cm_get_date.c +++ b/Source/cm_get_date.c @@ -2,6 +2,10 @@ file Copyright.txt or https://cmake.org/licensing for details. */ #include "cm_get_date.h" +// FIXME: This suppresses use of localtime_r because archive_getdate.c +// depends the rest of libarchive's checks for that. +#define CM_GET_DATE + #define __archive_get_date cm_get_date #include "../Utilities/cmlibarchive/libarchive/archive_getdate.c" diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt index ea0116f..d4729b5 100644 --- a/Utilities/cmlibarchive/CMakeLists.txt +++ b/Utilities/cmlibarchive/CMakeLists.txt @@ -91,11 +91,6 @@ SET(CMAKE_REQUIRED_DEFINITIONS) SET(CMAKE_REQUIRED_INCLUDES) SET(CMAKE_REQUIRED_LIBRARIES) SET(CMAKE_REQUIRED_FLAGS) -if (CMAKE_BUILD_TYPE STREQUAL "Debug") - OPTION(ENABLE_WERROR "Treat warnings as errors - default is ON for Debug, OFF otherwise." ON) -else () - OPTION(ENABLE_WERROR "Treat warnings as errors - default is ON for Debug, OFF otherwise." OFF) -endif () # Disable warnings to avoid changing 3rd party code. IF(CMAKE_C_COMPILER_ID MATCHES @@ -106,6 +101,12 @@ ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "PathScale") ENDIF() IF(0) # CMake does not need flags specific to libarchive upstream development. +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + OPTION(ENABLE_WERROR "Treat warnings as errors - default is ON for Debug, OFF otherwise." ON) +else () + OPTION(ENABLE_WERROR "Treat warnings as errors - default is ON for Debug, OFF otherwise." OFF) +endif () + # Especially for early development, we want to be a little # aggressive about diagnosing build problems; this can get # relaxed somewhat in final shipping versions. @@ -255,7 +256,6 @@ ENDIF(ENABLE_TEST) ENDIF() IF(WIN32) - #ELSEIF(WINDOWS_VERSION STREQUAL "WINXP") SET(NTDDI_VERSION 0x05010000) SET(_WIN32_WINNT 0x0501) SET(WINVER 0x0501) @@ -310,8 +310,6 @@ IF(MSVC) ENDIF(MSVC) ENDIF() -set(HAVE_PTHREAD_H 0) # no threads in CMake - IF("${CMAKE_C_PLATFORM_ID}" MATCHES "^(HP-UX)$") ADD_DEFINITIONS(-D_XOPEN_SOURCE=500) # Ask wchar.h for mbstate_t ENDIF() @@ -499,7 +497,6 @@ IF(BZIP2_FOUND) ADD_DEFINITIONS(-DUSE_BZIP2_STATIC) ENDIF(USE_BZIP2_DLL) ENDIF(BZIP2_FOUND) -MARK_AS_ADVANCED(CLEAR BZIP2_INCLUDE_DIR) # @@ -536,7 +533,6 @@ IF(LIBLZMA_FOUND) ELSE(LIBLZMA_FOUND) # LZMA not found and will not be used. ENDIF(LIBLZMA_FOUND) -IF(0) # CMake does not need LZO2 support in libarchive # # Find LZO2 # @@ -563,10 +559,6 @@ IF(LZO2_FOUND) # TODO: test for static library. # ENDIF(LZO2_FOUND) -MARK_AS_ADVANCED(CLEAR LZO2_INCLUDE_DIR) -MARK_AS_ADVANCED(CLEAR LZO2_LIBRARY) -ENDIF() -IF(0) # CMake does not need LZ4 support in libarchive # # Find libb2 # @@ -625,9 +617,6 @@ IF(LZ4_FOUND) # TODO: test for static library. # ENDIF(LZ4_FOUND) -MARK_AS_ADVANCED(CLEAR LZ4_INCLUDE_DIR) -MARK_AS_ADVANCED(CLEAR LZ4_LIBRARY) -ENDIF() # # Find Zstd # @@ -1183,7 +1172,6 @@ ELSE(ENABLE_ICONV) UNSET(LIBCHARSET_STATIC CACHE) ENDIF(ENABLE_ICONV) -IF(0) # CMake does not need XML support in libarchive # # Find Libxml2 # @@ -1230,9 +1218,6 @@ ELSE(LIBXML2_FOUND) CMAKE_POP_CHECK_STATE() # Restore the state of the variables ENDIF(EXPAT_FOUND) ENDIF(LIBXML2_FOUND) -MARK_AS_ADVANCED(CLEAR LIBXML2_INCLUDE_DIR) -MARK_AS_ADVANCED(CLEAR LIBXML2_LIBRARIES) -ENDIF() # # POSIX Regular Expression support diff --git a/Utilities/cmlibarchive/libarchive/archive_getdate.c b/Utilities/cmlibarchive/libarchive/archive_getdate.c index 3ec5bba..6786d35 100644 --- a/Utilities/cmlibarchive/libarchive/archive_getdate.c +++ b/Utilities/cmlibarchive/libarchive/archive_getdate.c @@ -27,7 +27,9 @@ ** This code is in the public domain and has no copyright. */ +#ifndef CM_GET_DATE #include "archive_platform.h" +#endif #ifdef __FreeBSD__ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); diff --git a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c index 82729bd..ec40cce 100644 --- a/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c +++ b/Utilities/cmlibarchive/libarchive/archive_read_support_format_rar5.c @@ -31,7 +31,7 @@ #endif #include <time.h> #ifdef HAVE_ZLIB_H -#include <zlib.h> /* crc32 */ +#include <cm_zlib.h> /* crc32 */ #endif #ifdef HAVE_LIMITS_H #include <limits.h> |