You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
4.4 KiB
116 lines
4.4 KiB
6 years ago
|
commit 58a06a071bd16825efe0e44d0729068e97014529
|
||
|
Author: Björn Esser <me@besser82.io>
|
||
|
Date: Tue Aug 23 13:48:13 2016 +0200
|
||
|
|
||
|
cmake3-libarchive3.patch
|
||
|
|
||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 3ef8605..84d3a56 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -384,7 +384,7 @@ macro (CMAKE_BUILD_UTILITIES)
|
||
|
#---------------------------------------------------------------------
|
||
|
# Build or use system libarchive for CMake and CTest.
|
||
|
if(CMAKE_USE_SYSTEM_LIBARCHIVE)
|
||
|
- find_package(LibArchive 3.0.0)
|
||
|
+ find_package(LibArchive3 3.0.0)
|
||
|
if(NOT LibArchive_FOUND)
|
||
|
message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBARCHIVE is ON but LibArchive is not found!")
|
||
|
endif()
|
||
|
diff --git a/Modules/FindLibArchive3.cmake b/Modules/FindLibArchive3.cmake
|
||
|
new file mode 100644
|
||
|
index 0000000..4e18975
|
||
|
--- /dev/null
|
||
|
+++ b/Modules/FindLibArchive3.cmake
|
||
|
@@ -0,0 +1,75 @@
|
||
|
+#.rst:
|
||
|
+# FindLibArchive3
|
||
|
+# ---------------
|
||
|
+#
|
||
|
+# Find libarchive library and headers
|
||
|
+#
|
||
|
+# The module defines the following variables:
|
||
|
+#
|
||
|
+# ::
|
||
|
+#
|
||
|
+# LibArchive_FOUND - true if libarchive was found
|
||
|
+# LibArchive_INCLUDE_DIRS - include search path
|
||
|
+# LibArchive_LIBRARIES - libraries to link
|
||
|
+# LibArchive_VERSION - libarchive 3-component version number
|
||
|
+
|
||
|
+#=============================================================================
|
||
|
+# Copyright 2010 Kitware, Inc.
|
||
|
+#
|
||
|
+# Distributed under the OSI-approved BSD License (the "License");
|
||
|
+# see accompanying file Copyright.txt for details.
|
||
|
+#
|
||
|
+# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||
|
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||
|
+# See the License for more information.
|
||
|
+#=============================================================================
|
||
|
+# (To distribute this file outside of CMake, substitute the full
|
||
|
+# License text for the above reference.)
|
||
|
+
|
||
|
+find_path(LibArchive_INCLUDE_DIR
|
||
|
+ NAMES archive3.h
|
||
|
+ PATHS
|
||
|
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\LibArchive;InstallPath]/include"
|
||
|
+ )
|
||
|
+
|
||
|
+find_library(LibArchive_LIBRARY
|
||
|
+ NAMES archive3 libarchive3
|
||
|
+ PATHS
|
||
|
+ "[HKEY_LOCAL_MACHINE\\SOFTWARE\\GnuWin32\\LibArchive;InstallPath]/lib"
|
||
|
+ )
|
||
|
+
|
||
|
+mark_as_advanced(LibArchive_INCLUDE_DIR LibArchive_LIBRARY)
|
||
|
+
|
||
|
+# Extract the version number from the header.
|
||
|
+if(LibArchive_INCLUDE_DIR AND EXISTS "${LibArchive_INCLUDE_DIR}/archive3.h")
|
||
|
+ # The version string appears in one of three known formats in the header:
|
||
|
+ # #define ARCHIVE_LIBRARY_VERSION "libarchive 2.4.12"
|
||
|
+ # #define ARCHIVE_VERSION_STRING "libarchive 2.8.4"
|
||
|
+ # #define ARCHIVE_VERSION_ONLY_STRING "3.2.0"
|
||
|
+ # Match any format.
|
||
|
+ set(_LibArchive_VERSION_REGEX "^#define[ \t]+ARCHIVE[_A-Z]+VERSION[_A-Z]*[ \t]+\"(libarchive +)?([0-9]+)\\.([0-9]+)\\.([0-9]+)[^\"]*\".*$")
|
||
|
+ file(STRINGS "${LibArchive_INCLUDE_DIR}/archive3.h" _LibArchive_VERSION_STRING LIMIT_COUNT 1 REGEX "${_LibArchive_VERSION_REGEX}")
|
||
|
+ if(_LibArchive_VERSION_STRING)
|
||
|
+ string(REGEX REPLACE "${_LibArchive_VERSION_REGEX}" "\\2.\\3.\\4" LibArchive_VERSION "${_LibArchive_VERSION_STRING}")
|
||
|
+ endif()
|
||
|
+ unset(_LibArchive_VERSION_REGEX)
|
||
|
+ unset(_LibArchive_VERSION_STRING)
|
||
|
+endif()
|
||
|
+
|
||
|
+# Handle the QUIETLY and REQUIRED arguments and set LIBARCHIVE_FOUND
|
||
|
+# to TRUE if all listed variables are TRUE.
|
||
|
+# (Use ${CMAKE_ROOT}/Modules instead of ${CMAKE_CURRENT_LIST_DIR} because CMake
|
||
|
+# itself includes this FindLibArchive when built with an older CMake that does
|
||
|
+# not provide it. The older CMake also does not have CMAKE_CURRENT_LIST_DIR.)
|
||
|
+include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
|
||
|
+find_package_handle_standard_args(LibArchive
|
||
|
+ REQUIRED_VARS LibArchive_LIBRARY LibArchive_INCLUDE_DIR
|
||
|
+ VERSION_VAR LibArchive_VERSION
|
||
|
+ )
|
||
|
+set(LibArchive_FOUND ${LIBARCHIVE_FOUND})
|
||
|
+unset(LIBARCHIVE_FOUND)
|
||
|
+
|
||
|
+if(LibArchive_FOUND)
|
||
|
+ set(LibArchive_INCLUDE_DIRS ${LibArchive_INCLUDE_DIR})
|
||
|
+ set(LibArchive_LIBRARIES ${LibArchive_LIBRARY})
|
||
|
+endif()
|
||
|
diff --git a/Utilities/cm_libarchive.h b/Utilities/cm_libarchive.h
|
||
|
index c6a8a82..8fa06b4 100644
|
||
|
--- a/Utilities/cm_libarchive.h
|
||
|
+++ b/Utilities/cm_libarchive.h
|
||
|
@@ -15,8 +15,8 @@
|
||
|
/* Use the libarchive configured for CMake. */
|
||
|
#include "cmThirdParty.h"
|
||
|
#ifdef CMAKE_USE_SYSTEM_LIBARCHIVE
|
||
|
-#include <archive.h>
|
||
|
-#include <archive_entry.h>
|
||
|
+#include <archive3.h>
|
||
|
+#include <archive_entry3.h>
|
||
|
#else
|
||
|
#include <cmlibarchive/libarchive/archive.h>
|
||
|
#include <cmlibarchive/libarchive/archive_entry.h>
|