You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2018/10/31 20:54:36 UTC
[mesos] 01/02: Allowed for unbundled libarchive on cmake builds.
This is an automated email from the ASF dual-hosted git repository.
tillt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit a73fcb2aca53596bb419c6c3dc8b73854d135442
Author: Till Toenshoff <to...@me.com>
AuthorDate: Wed Oct 31 12:45:47 2018 -0700
Allowed for unbundled libarchive on cmake builds.
Review: https://reviews.apache.org/r/69140/
---
3rdparty/CMakeLists.txt | 8 +++---
3rdparty/cmake/FindLIBARCHIVE.cmake | 52 +++++++++++++++++++++++++++++++++++++
cmake/CompilationConfigure.cmake | 11 ++++++++
3 files changed, 67 insertions(+), 4 deletions(-)
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index 9584f53..fb80b39 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -995,7 +995,7 @@ set_target_properties(
# libarchive: Multi-format archive and compression library.
# https://github.com/libarchive/libarchive
###########################################################
-if (WIN32 OR REBUNDLED)
+if (NOT UNBUNDLED_LIBARCHIVE)
EXTERNAL(libarchive ${LIBARCHIVE_VERSION} ${CMAKE_CURRENT_BINARY_DIR})
add_library(libarchive STATIC IMPORTED GLOBAL)
@@ -1069,11 +1069,11 @@ if (WIN32 OR REBUNDLED)
URL ${LIBARCHIVE_URL}
URL_HASH ${LIBARCHIVE_HASH})
else ()
- find_package(LibArchive REQUIRED)
+ find_package(LIBARCHIVE REQUIRED)
add_library(libarchive SHARED IMPORTED GLOBAL)
set_target_properties(libarchive PROPERTIES
- IMPORTED_LOCATION ${LibArchive_LIBRARIES}
- INTERFACE_INCLUDE_DIRECTORIES ${LibArchive_INCLUDE_DIRS})
+ IMPORTED_LOCATION ${LIBARCHIVE_LIBS}
+ INTERFACE_INCLUDE_DIRECTORIES ${LIBARCHIVE_INCLUDE_DIR})
endif ()
# Google Test: Google's C++ test framework (GoogleTest and GoogleMock).
diff --git a/3rdparty/cmake/FindLIBARCHIVE.cmake b/3rdparty/cmake/FindLIBARCHIVE.cmake
new file mode 100644
index 0000000..f0c29d0
--- /dev/null
+++ b/3rdparty/cmake/FindLIBARCHIVE.cmake
@@ -0,0 +1,52 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+include(FindPackageHelper)
+
+# TODO(tillt): Consider moving "_ROOT_DIR" logic into FindPackageHelper.
+if ("${LIBARCHIVE_ROOT_DIR}" STREQUAL "")
+ # NOTE: If this fails, stderr is ignored, and the output variable is empty.
+ # This has no deleterious effect on our path search.
+ execute_process(
+ COMMAND brew --prefix libarchive
+ OUTPUT_VARIABLE LIBARCHIVE_PREFIX
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ set(POSSIBLE_LIBARCHIVE_INCLUDE_DIRS "")
+ set(POSSIBLE_LIBARCHIVE_LIB_DIRS "")
+
+ if (NOT "${LIBARCHIVE_PREFIX}" STREQUAL "")
+ list(APPEND POSSIBLE_LIBARCHIVE_INCLUDE_DIRS ${LIBARCHIVE_PREFIX}/include)
+ list(APPEND POSSIBLE_LIBARCHIVE_LIB_DIRS ${LIBARCHIVE_PREFIX}/lib)
+ endif()
+
+ list(
+ APPEND POSSIBLE_LIBARCHIVE_INCLUDE_DIRS
+ /usr/include/libarchive
+ /usr/local/include/libarchive)
+
+ list(
+ APPEND POSSIBLE_LIBARCHIVE_LIB_DIRS
+ /usr/lib
+ /usr/local/lib)
+else()
+ set(POSSIBLE_LIBARCHIVE_INCLUDE_DIRS ${LIBARCHIVE_ROOT_DIR}/include)
+ set(POSSIBLE_LIBARCHIVE_LIB_DIRS ${LIBARCHIVE_ROOT_DIR}/lib)
+endif()
+
+set(LIBARCHIVE_LIBRARY_NAMES archive)
+
+FIND_PACKAGE_HELPER(LIBARCHIVE archive.h)
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index 5d2be0a..f6c6e62 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -75,6 +75,17 @@ option(
TRUE)
option(
+ UNBUNDLED_LIBARCHIVE
+ "Build with an installed libarchive version instead of the bundled."
+ FALSE)
+
+set(
+ LIBARCHIVE_ROOT_DIR
+ ""
+ CACHE STRING
+ "Specify the path to libarchive, e.g. \"C:\\libarchive-Win64\".")
+
+option(
ENABLE_LIBEVENT
"Use libevent instead of libev as the core event loop implementation."
FALSE)