Skip to content

Commit e64f87a

Browse files
cmake: Use REPO_VERSION flag
1 parent 4f2f7e4 commit e64f87a

File tree

4 files changed

+9
-42
lines changed

4 files changed

+9
-42
lines changed

CMakeLists.txt

+4-1
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,14 @@ set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_CURRENT_SOURCE_DIR}/build/
3131
# TODO: add `git rev-parse --short HEAD`
3232
# Read the version information from the Autoconf file
3333
file (STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/configure.ac" CONFIGURE_AC REGEX "AC_INIT\\(.*\\)" )
34+
option (THRIFT_VERSION "VERSION" ${CONFIGURE_AC})
3435

3536
# The following variable is used in the version.h.in file
36-
string(REGEX REPLACE "AC_INIT\\(\\[.*\\], \\[([0-9]+\\.[0-9]+\\.[0-9]+(-upfluence)?)\\]\\)" "\\1" PACKAGE_VERSION ${CONFIGURE_AC})
37+
string(REGEX REPLACE "AC_INIT\\(\\[.*\\], \\[([0-9]+\\.[0-9]+\\.[0-9]+(-upfluence)?)\\]\\)" "\\1" PACKAGE_VERSION ${THRIFT_VERSION})
3738
message(STATUS "Parsed Thrift package version: ${PACKAGE_VERSION}")
3839

40+
set(REPO_VERSION "${THRIFT_VERSION}")
41+
3942
# These are internal to CMake
4043
string(REGEX REPLACE "([0-9]+\\.[0-9]+\\.[0-9]+)(-upfluence)?" "\\1" thrift_VERSION ${PACKAGE_VERSION})
4144
string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" thrift_VERSION_MAJOR ${thrift_VERSION})

compiler/cpp/cmake_install.cmake

-39
This file was deleted.

compiler/cpp/version.h.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
#define THRIFT_VERSION "@PACKAGE_VERSION@"
1+
#define THRIFT_VERSION "@REPO_VERSION@"
22
#define THRIFT_TYPES_PATH "@TYPES_PREFIX@"
33
#define THRIFT_TYPES_NESTED_PATH "@TYPES_PREFIX@/types"

configure.ac

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
AC_PREREQ(2.65)
2121
AC_CONFIG_MACRO_DIR([./aclocal])
2222

23-
AC_INIT([thrift], [2.5.1-upfluence])
23+
AC_ARG_VAR([REPO_VERSION], [])
24+
AS_IF([test "x$REPO_VERSION" = x], [REPO_VERSION="dirty"])
25+
26+
AC_INIT([thrift], [1.0.0])
2427

2528
AC_CONFIG_AUX_DIR([.])
2629

0 commit comments

Comments
 (0)