Skip to content
This repository has been archived by the owner on Mar 29, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1 from isaachier/hunter-0.10.0
Browse files Browse the repository at this point in the history
Hunter 0.10.0
  • Loading branch information
ruslo committed Sep 28, 2017
2 parents b2a4d4a + 36f48e7 commit d2c3ef4
Show file tree
Hide file tree
Showing 9 changed files with 684 additions and 60 deletions.
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
# under the License.
#

cmake_minimum_required(VERSION 2.8.12)

project("Apache Thrift")
cmake_minimum_required(VERSION 3.1)

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake")

include(HunterGate)
HunterGate(URL "https://github.com/ruslo/hunter/archive/v0.19.112.tar.gz"
SHA1 "74cd301e87d79c09133b4ee252f202cd489203d8")

# TODO: add `git rev-parse --short HEAD`
# Read the version information from the Autoconf file
file (STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" CONFIGURE_AC REGEX "AC_INIT\\(.*\\)" )
Expand All @@ -38,6 +40,8 @@ string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" thrift_VERSION_MINOR ${t
string(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" thrift_VERSION_PATCH ${thrift_VERSION})
message(STATUS "Parsed Thrift version: ${thrift_VERSION} (${thrift_VERSION_MAJOR}.${thrift_VERSION_MINOR}.${thrift_VERSION_PATCH})")

project(thrift VERSION ${thrift_VERSION})

# Some default settings
include(DefineCMakeDefaults)

Expand Down
17 changes: 17 additions & 0 deletions build/cmake/Config.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@PACKAGE_INIT@

set(package_deps @package_deps@)
foreach(dep IN LISTS package_deps)
if(dep STREQUAL "OpenSSL")
find_package(OpenSSL REQUIRED)
else()
find_package(${dep} CONFIG REQUIRED)
endif()
endforeach()

set(boost_components @boost_components@)
find_package(Boost CONFIG REQUIRED ${boost_components})

check_required_components("@PROJECT_NAME@")

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
35 changes: 12 additions & 23 deletions build/cmake/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,40 +50,25 @@ endif()
# C++
option(WITH_CPP "Build C++ Thrift library" ON)
if(WITH_CPP)
find_package(Boost 1.53 QUIET)
# NOTE: Currently the following options are C++ specific,
# but in future other libraries might reuse them.
# So they are not dependent on WITH_CPP but setting them without WITH_CPP currently
# has no effect.
if(ZLIB_LIBRARY)
# FindZLIB.cmake does not normalize path so we need to do it ourselves.
file(TO_CMAKE_PATH ${ZLIB_LIBRARY} ZLIB_LIBRARY)
endif()
find_package(ZLIB QUIET)
CMAKE_DEPENDENT_OPTION(WITH_ZLIB "Build with ZLIB support" ON
"ZLIB_FOUND" OFF)
find_package(Libevent QUIET)
CMAKE_DEPENDENT_OPTION(WITH_LIBEVENT "Build with libevent support" ON
"Libevent_FOUND" OFF)
find_package(Qt4 QUIET COMPONENTS QtCore QtNetwork)
CMAKE_DEPENDENT_OPTION(WITH_QT4 "Build with Qt4 support" ON
"QT4_FOUND" OFF)
find_package(Qt5 QUIET COMPONENTS Core Network)
CMAKE_DEPENDENT_OPTION(WITH_QT5 "Build with Qt5 support" ON
"Qt5_FOUND" OFF)
option(WITH_ZLIB "Build with ZLIB support" ON)
option(WITH_LIBEVENT "Build with libevent support" ON)
option(WITH_QT4 "Build with Qt4 support" ON)
option(WITH_QT5 "Build with Qt5 support" ON)
if(${WITH_QT4} AND ${WITH_QT5} AND ${CMAKE_MAJOR_VERSION} LESS 3)
# cmake < 3.0.0 causes conflict when building both Qt4 and Qt5
set(WITH_QT4 OFF)
endif()
find_package(OpenSSL QUIET)
CMAKE_DEPENDENT_OPTION(WITH_OPENSSL "Build with OpenSSL support" ON
"OPENSSL_FOUND" OFF)
option(WITH_OPENSSL "Build with OpenSSL support" ON)
option(WITH_STDTHREADS "Build with C++ std::thread support" OFF)
CMAKE_DEPENDENT_OPTION(WITH_BOOSTTHREADS "Build with Boost threads support" OFF
"NOT WITH_STDTHREADS;Boost_FOUND" OFF)
"NOT WITH_STDTHREADS" OFF)
endif()
CMAKE_DEPENDENT_OPTION(BUILD_CPP "Build C++ library" ON
"BUILD_LIBRARIES;WITH_CPP;Boost_FOUND" OFF)
"BUILD_LIBRARIES;WITH_CPP" OFF)
CMAKE_DEPENDENT_OPTION(WITH_PLUGIN "Build compiler plugin support" ON
"BUILD_COMPILER;BUILD_CPP" OFF)

Expand All @@ -104,7 +89,11 @@ if(BUILD_CPP)
list(APPEND boost_components unit_test_framework filesystem chrono program_options)
endif()
if(boost_components)
find_package(Boost 1.53 REQUIRED COMPONENTS ${boost_components})
hunter_add_package(Boost COMPONENTS ${boost_components})
find_package(Boost CONFIG REQUIRED ${boost_components})
else()
hunter_add_package(Boost)
find_package(Boost CONFIG REQUIRED)
endif()
elseif(BUILD_C_GLIB AND BUILD_TESTING)
find_package(Boost 1.53 REQUIRED)
Expand Down
Loading

0 comments on commit d2c3ef4

Please sign in to comment.