Skip to content

Commit 82a6b7f

Browse files
Fix C++ version and ABI/SONAME version for 28.0.0 (#306)
* Fix C++ version and ABI/SONAME version for 28.0.0 * Read the C++ versions from the VERSION file
1 parent 4d38486 commit 82a6b7f

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

cpp/CMakeLists.txt

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
###
2-
#
3-
# Project
4-
# name and version
5-
#
6-
###
7-
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
1+
# The VERSION here is a placeholder; the real version is in the VERSION file.
2+
set(VERSION 28.0.0)
83

9-
project(cucumber_messages VERSION 27.0.2 LANGUAGES C CXX)
4+
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION")
5+
file(STRINGS "VERSION" LINES)
6+
list(GET LINES 0 VERSION)
7+
endif()
8+
9+
# Crude Semver parsing
10+
if("${VERSION}" MATCHES "^([^\\.]+)\\.([^\\.]+)\\.([^\\.]+)$")
11+
set(VER_MAJOR ${CMAKE_MATCH_1})
12+
set(VER_MINOR ${CMAKE_MATCH_2})
13+
set(VER_PATCH ${CMAKE_MATCH_3})
14+
else()
15+
message(FATAL_ERROR "unable to parse version: ${VERSION}")
16+
endif()
17+
18+
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
19+
project(cucumber_messages VERSION ${VERSION} LANGUAGES C CXX)
1020

1121
###
1222
#

cpp/src/lib/messages/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ set_target_properties(
3434
cucumber_messages_lib
3535
PROPERTIES
3636
CXX_STANDARD 17
37-
VERSION 27.0.2
38-
SOVERSION 27
37+
VERSION ${VERSION}
38+
SOVERSION ${VER_MAJOR}
3939
EXPORT_NAME messages
4040
OUTPUT_NAME cucumber_messages
4141
)

0 commit comments

Comments
 (0)