diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 119813e290f..7b84f12b678 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 $ ${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 f9511fc46e8..af1a8b57079 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."