Skip to content

Commit d0fa874

Browse files
committed
Parse WSREP_LIB_VERSION from version header.
1 parent cfdf265 commit d0fa874

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

CMakeLists.txt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,27 @@
33
#
44

55
cmake_minimum_required (VERSION 2.8)
6-
project (wsrep-lib)
6+
7+
# Parse version from version header file and store it into
8+
# WSREP_LIB_VERSION.
9+
file (READ "include/wsrep/version.hpp" ver)
10+
string(REGEX MATCH "WSREP_LIB_VERSION_MAJOR ([0-9]*)" _ ${ver})
11+
set(ver_major ${CMAKE_MATCH_1})
12+
file (READ "include/wsrep/version.hpp" ver)
13+
string(REGEX MATCH "WSREP_LIB_VERSION_MINOR ([0-9]*)" _ ${ver})
14+
set(ver_minor ${CMAKE_MATCH_1})
15+
file (READ "include/wsrep/version.hpp" ver)
16+
string(REGEX MATCH "WSREP_LIB_VERSION_PATCH ([0-9]*)" _ ${ver})
17+
set(ver_patch ${CMAKE_MATCH_1})
18+
set(WSREP_LIB_VERSION "${ver_major}.${ver_minor}.${ver_patch}")
19+
message(STATUS "Wsrep-lib version: ${WSREP_LIB_VERSION}")
20+
21+
if (CMP0048 EQUAL NEW)
22+
project(wsrep-lib VERSION ${WSREP_LIB_VERSION})
23+
else()
24+
project(wsrep-lib)
25+
endif()
26+
727
include(CheckIncludeFile)
828

929
# Options

0 commit comments

Comments
 (0)