summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJames E. King III <jking@apache.org>2019-01-07 16:46:45 -0500
committerJames E. King III <jking@apache.org>2019-01-09 17:05:34 -0500
commitc9ac8d2953a4806cc93aa4ff2e700623ecad980c (patch)
tree74cb331a75066bc9b13910652a3724606fa65bbe /CMakeLists.txt
parenta5df39032ca206e2e6a9ec975147e81746d9a255 (diff)
downloadthrift-c9ac8d2953a4806cc93aa4ff2e700623ecad980c.tar.gz
THRIFT-4720: documenting breaking changes, minor cleanup
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt43
1 files changed, 18 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9f57a66c4..e6dd5638b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,33 +17,25 @@
# under the License.
#
-cmake_minimum_required(VERSION 3.1)
+cmake_minimum_required(VERSION 3.3)
-# CMake 3.1 supports C++ standards selection with CMAKE_CXX_STANDARD
-# If you need CMake 3.1+ for Ubuntu 14.04, try
-# https://launchpad.net/~george-edison55/+archive/ubuntu/cmake-3.x
-# If you need CMake 3.1+ for debian "jessie", get it from jessie-backports
-# Otherwise
-# http://cmake.org
-
-project("Apache Thrift")
+if(POLICY CMP0048)
+ cmake_policy(SET CMP0048 NEW) # package version behavior added in cmake 3.0
+endif()
+if(POLICY CMP0074)
+ cmake_policy(SET CMP0074 NEW) # find_package behavior added in cmake 3.12
+endif()
-set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake")
+# PACKAGE_VERSION is used by cpack scripts currently
+# Both thrift_VERSION and PACKAGE_VERSION should be the same for now
+set(thrift_VERSION "1.0.0")
+set(PACKAGE_VERSION ${thrift_VERSION})
-# 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\\(.*\\)" )
+project("thrift" VERSION ${PACKAGE_VERSION})
+message(STATUS "Configuring ${CMAKE_PROJECT_NAME} ${thrift_VERSION}")
-# The following variable is used in the version.h.in file
-string(REGEX REPLACE "AC_INIT\\(\\[.*\\], \\[([0-9]+\\.[0-9]+\\.[0-9]+(-dev)?)\\]\\)" "\\1" PACKAGE_VERSION ${CONFIGURE_AC})
-message(STATUS "Parsed Thrift package version: ${PACKAGE_VERSION}")
-# These are internal to CMake
-string(REGEX REPLACE "([0-9]+\\.[0-9]+\\.[0-9]+)(-dev)?" "\\1" thrift_VERSION ${PACKAGE_VERSION})
-string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" thrift_VERSION_MAJOR ${thrift_VERSION})
-string(REGEX REPLACE "[0-9]+\\.([0-9])+\\.[0-9]+" "\\1" thrift_VERSION_MINOR ${thrift_VERSION})
-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})")
+set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake")
# Some default settings
include(DefineCMakeDefaults)
@@ -58,13 +50,14 @@ include(DefinePlatformSpecifc)
# Generate the config.h file
include(ConfigureChecks)
-# Package it
+# Packaging
include(CPackConfig)
-
+# Dependencies
+include(BoostMacros)
find_package(Threads)
-
include(CTest)
+
if(BUILD_TESTING)
message(STATUS "Building with unittests")