Added FetchContent command to cmake so that patches are applied automatically to libarchive clone

This commit is contained in:
Andrei Medar 2020-10-01 19:01:50 +00:00
parent c5d44eab37
commit b4c64dac69
3 changed files with 11 additions and 8 deletions

3
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "oss-internship-2020/sapi_libarchive/libarchive"]
path = oss-internship-2020/libarchive/libarchive
url = https://github.com/libarchive/libarchive
[submodule "oss-internship-2020/openjpeg/openjpeg"]
path = oss-internship-2020/openjpeg/openjpeg
url = https://github.com/uclouvain/openjpeg.git

View File

@ -20,9 +20,16 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED 17)
# Build SAPI library
set(SAPI_ROOT "" CACHE PATH "Path to the Sandboxed API source tree")
#set(SAPI_ROOT "" CACHE PATH "Path to the Sandboxed API source tree")
set(SAPI_ROOT "/usr/local/google/home/amedar/internship/sandboxed-api" CACHE PATH "Path to the Sandboxed API source tree")
add_subdirectory(libarchive)
include(FetchContent)
FetchContent_Declare(
libarchive
GIT_REPOSITORY https://github.com/libarchive/libarchive
PATCH_COMMAND cd libarchive && patch < ${CMAKE_SOURCE_DIR}/patches/header.patch && patch < ${CMAKE_SOURCE_DIR}/patches/archive_virtual.patch
)
FetchContent_MakeAvailable(libarchive)
add_subdirectory("${SAPI_ROOT}"
"${CMAKE_BINARY_DIR}/sandboxed-api-build"
@ -37,8 +44,8 @@ add_sapi_library(
FUNCTIONS ${FUNCTIONS_LIST}
INPUTS
libarchive/libarchive/archive.h
libarchive/libarchive/archive_entry.h
${CMAKE_BINARY_DIR}/_deps/libarchive-src/libarchive/archive.h
${CMAKE_BINARY_DIR}/_deps/libarchive-src/libarchive/archive_entry.h
LIBRARY archive_static
LIBRARY_NAME Libarchive

@ -1 +0,0 @@
Subproject commit 34940ef6ea0b21d77cb501d235164ad88f19d40c