You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by gr...@apache.org on 2020/05/11 20:47:43 UTC
[mesos] 02/02: Added ability to specify a root dir for boost and
curl with cmake.
This is an automated email from the ASF dual-hosted git repository.
grag pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 07cd355f90892a897e0b210a8cd0eda6103ae6c9
Author: Andriy Kornatskyy <an...@live.com>
AuthorDate: Fri May 8 14:11:10 2020 -0700
Added ability to specify a root dir for boost and curl with cmake.
This closes #361
---
3rdparty/CMakeLists.txt | 61 +++++++++++++++++++++++++---------------
cmake/CompilationConfigure.cmake | 14 +++++++++
2 files changed, 53 insertions(+), 22 deletions(-)
diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
index 119813e..7b84f12 100644
--- a/3rdparty/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt
@@ -194,29 +194,34 @@ endfunction()
# Boost: C++ Libraries.
# http://www.boost.org
#######################
-EXTERNAL(boost ${BOOST_VERSION} ${CMAKE_CURRENT_BINARY_DIR})
-add_library(boost INTERFACE)
-add_dependencies(boost ${BOOST_TARGET})
-if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang)
- # Headers including Boost 1.65.0 fail to compile with GCC 7.2 and
- # CLang 3.6 without `-Wno-unused-local-typedefs`.
- # TODO(andschwa): Remove this when Boost has a resolution.
- target_compile_options(boost INTERFACE -Wno-unused-local-typedefs)
-endif ()
-target_include_directories(boost INTERFACE ${BOOST_ROOT})
+if ("${BOOST_ROOT_DIR}" STREQUAL "")
+ EXTERNAL(boost ${BOOST_VERSION} ${CMAKE_CURRENT_BINARY_DIR})
+ add_library(boost INTERFACE)
+ add_dependencies(boost ${BOOST_TARGET})
+ if (CMAKE_CXX_COMPILER_ID MATCHES GNU OR CMAKE_CXX_COMPILER_ID MATCHES Clang)
+ # Headers including Boost 1.65.0 fail to compile with GCC 7.2 and
+ # CLang 3.6 without `-Wno-unused-local-typedefs`.
+ # TODO(andschwa): Remove this when Boost has a resolution.
+ target_compile_options(boost INTERFACE -Wno-unused-local-typedefs)
+ endif ()
+ target_include_directories(boost INTERFACE ${BOOST_ROOT})
-# Patch Boost to avoid repeated "Unknown compiler warnings" on Windows.
-PATCH_CMD(BOOST_PATCH_CMD boost-${BOOST_VERSION}.patch)
+ # Patch Boost to avoid repeated "Unknown compiler warnings" on Windows.
+ PATCH_CMD(BOOST_PATCH_CMD boost-${BOOST_VERSION}.patch)
-ExternalProject_Add(
- ${BOOST_TARGET}
- PREFIX ${BOOST_CMAKE_ROOT}
- PATCH_COMMAND ${BOOST_PATCH_CMD}
- CONFIGURE_COMMAND ${CMAKE_NOOP}
- BUILD_COMMAND ${CMAKE_NOOP}
- INSTALL_COMMAND ${CMAKE_NOOP}
- URL ${BOOST_URL}
- URL_HASH ${BOOST_HASH})
+ ExternalProject_Add(
+ ${BOOST_TARGET}
+ PREFIX ${BOOST_CMAKE_ROOT}
+ PATCH_COMMAND ${BOOST_PATCH_CMD}
+ CONFIGURE_COMMAND ${CMAKE_NOOP}
+ BUILD_COMMAND ${CMAKE_NOOP}
+ INSTALL_COMMAND ${CMAKE_NOOP}
+ URL ${BOOST_URL}
+ URL_HASH ${BOOST_HASH})
+else ()
+ add_library(boost INTERFACE)
+ target_include_directories(boost INTERFACE ${BOOST_ROOT_DIR}/include)
+endif ()
# moodycamel::ConcurrentQueue: An industrial-strength lock-free queue.
@@ -861,7 +866,19 @@ if (WIN32)
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:curl> ${CMAKE_BINARY_DIR}/src/curl.exe
DEPENDEES build)
else ()
- find_package(CURL REQUIRED)
+ if ("${CURL_ROOT_DIR}" STREQUAL "")
+ find_package(CURL REQUIRED)
+ else ()
+ set(POSSIBLE_CURL_INCLUDE_DIRS ${CURL_ROOT_DIR}/include)
+ set(POSSIBLE_CURL_LIB_DIRS ${CURL_ROOT_DIR}/lib)
+
+ set(CURL_LIBRARY_NAMES curl)
+
+ FIND_PACKAGE_HELPER(CURL curl/curl.h)
+ SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
+ SET(CURL_LIBRARIES ${CURL_LIBS})
+ endif ()
+
add_library(libcurl SHARED IMPORTED)
set_target_properties(
diff --git a/cmake/CompilationConfigure.cmake b/cmake/CompilationConfigure.cmake
index f9511fc..af1a8b5 100644
--- a/cmake/CompilationConfigure.cmake
+++ b/cmake/CompilationConfigure.cmake
@@ -103,6 +103,20 @@ if (ENABLE_LIBEVENT)
"Specify the path to libevent, e.g. \"C:\\libevent-Win64\".")
endif()
+set(
+ BOOST_ROOT_DIR
+ ""
+ CACHE STRING
+ "Specify the path to boost.")
+
+if (NOT WIN32)
+ set(
+ CURL_ROOT_DIR
+ ""
+ CACHE STRING
+ "Specify the path to libcurl.")
+endif()
+
option(
UNBUNDLED_LEVELDB
"Build with an installed leveldb version instead of the bundled."