forked from mariadb-corporation/mariadb-columnstore-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
columnstore_version.cmake
46 lines (37 loc) · 1.58 KB
/
columnstore_version.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# Generate "something" to trigger cmake rerun when VERSION changes
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/VERSION
${CMAKE_BINARY_DIR}/VERSION.dep
)
# Read value for a variable from VERSION.
MACRO(COLUMNSTORE_GET_CONFIG_VALUE keyword var)
IF(NOT ${var})
FILE (STRINGS ${CMAKE_SOURCE_DIR}/VERSION str REGEX "^[ ]*${keyword}=")
IF(str)
STRING(REPLACE "${keyword}=" "" str ${str})
STRING(REGEX REPLACE "[ ].*" "" str "${str}")
SET(${var} ${str})
ENDIF()
ENDIF()
ENDMACRO()
MACRO(GET_COLUMNSTORE_VERSION)
COLUMNSTORE_GET_CONFIG_VALUE("COLUMNSTORE_VERSION_MAJOR" MAJOR_VERSION)
COLUMNSTORE_GET_CONFIG_VALUE("COLUMNSTORE_VERSION_MINOR" MINOR_VERSION)
COLUMNSTORE_GET_CONFIG_VALUE("COLUMNSTORE_VERSION_PATCH" PATCH_VERSION)
COLUMNSTORE_GET_CONFIG_VALUE("COLUMNSTORE_VERSION_EXTRA" EXTRA_VERSION)
COLUMNSTORE_GET_CONFIG_VALUE("COLUMNSTORE_VERSION_RELEASE" RELEASE_VERSION)
IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR
NOT "${MINOR_VERSION}" MATCHES "[0-9]+" OR
NOT "${PATCH_VERSION}" MATCHES "[0-9]+")
MESSAGE(FATAL_ERROR "VERSION file cannot be parsed.")
ENDIF()
SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}")
MESSAGE(STATUS "MariaDB-Columnstore ${VERSION}")
SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION})
SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION}${EXTRA_VERSION})
SET(PACKAGE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}")
SET(PACKAGE_RELEASE "${RELEASE_VERSION}")
ENDMACRO()
# Get columnstore version
GET_COLUMNSTORE_VERSION()