Skip to content

Commit 0375af2

Browse files
committed
drop version qualifier
This should help keep version.h stable. x.y.z-dev => major, minor, patch, qual == x, y, z, -dev But we do not need -dev anymore.
1 parent ba33089 commit 0375af2

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

CMakeLists.txt

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,17 @@ FUNCTION(set_using_dynamic_name VAR_NAME VALUE)
3131
SET( "${VAR_NAME}" "${VALUE}" PARENT_SCOPE)
3232
ENDFUNCTION(set_using_dynamic_name)
3333

34-
# Extract major, minor, patch and qualifier from version text
35-
# Parse a version string "X.Y.Z[-qualifier]" and outputs
36-
# version parts in ${OUPUT_PREFIX}_MAJOR, _MINOR, _PATCH, _QUALIFIER.
34+
# Extract major, minor, patch from version text
35+
# Parse a version string "X.Y.Z" and outputs
36+
# version parts in ${OUPUT_PREFIX}_MAJOR, _MINOR, _PATCH.
3737
# If parse succeeds then ${OUPUT_PREFIX}_FOUND is TRUE.
3838
MACRO(jsoncpp_parse_version VERSION_TEXT OUPUT_PREFIX)
3939
SET(VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?")
4040
IF( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
4141
STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${VERSION_TEXT})
42-
list(APPEND VERSION_PARTS "") # empty qualifier to handle no qualifier case
4342
LIST(GET VERSION_PARTS 0 ${OUPUT_PREFIX}_MAJOR)
4443
LIST(GET VERSION_PARTS 1 ${OUPUT_PREFIX}_MINOR)
4544
LIST(GET VERSION_PARTS 2 ${OUPUT_PREFIX}_PATCH)
46-
LIST(GET VERSION_PARTS 3 ${OUPUT_PREFIX}_QUALIFIER)
4745
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" TRUE )
4846
ELSE( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
4947
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" FALSE )
@@ -55,10 +53,10 @@ FILE(STRINGS "version" JSONCPP_VERSION)
5553

5654
jsoncpp_parse_version( ${JSONCPP_VERSION} JSONCPP_VERSION )
5755
IF(NOT JSONCPP_VERSION_FOUND)
58-
MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z[-qualifier]")
56+
MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z")
5957
ENDIF(NOT JSONCPP_VERSION_FOUND)
6058

61-
MESSAGE(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}${JSONCPP_VERSION_QUALIFIER}")
59+
MESSAGE(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}")
6260
# File version.h is only regenerated on CMake configure step
6361
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/lib_json/version.h.in"
6462
"${PROJECT_SOURCE_DIR}/include/json/version.h" )

include/json/version.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
// and "version.h.in" files.
33
// Run CMake configure step to update it.
44
#ifndef JSON_VERSION_H_INCLUDED
5-
#define JSON_VERSION_H_INCLUDED
5+
# define JSON_VERSION_H_INCLUDED
66

7-
#define JSONCPP_VERSION_STRING "0.7.0"
8-
#define JSONCPP_VERSION_MAJOR 0
9-
#define JSONCPP_VERSION_MINOR 7
10-
#define JSONCPP_VERSION_PATCH 0
11-
#define JSONCPP_VERSION_QUALIFIER
12-
#define JSONCPP_VERSION_HEXA \
13-
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
14-
(JSONCPP_VERSION_PATCH << 8))
7+
# define JSONCPP_VERSION_STRING "0.7.0"
8+
# define JSONCPP_VERSION_MAJOR 0
9+
# define JSONCPP_VERSION_MINOR 7
10+
# define JSONCPP_VERSION_PATCH 0
11+
# define JSONCPP_VERSION_QUALIFIER
12+
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
1513

1614
#endif // JSON_VERSION_H_INCLUDED

src/lib_json/version.h.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// DO NOT EDIT. This file is generated by CMake from "version"
1+
// DO NOT EDIT. This file is generated by CMake from "version"
22
// and "version.h.in" files.
33
// Run CMake configure step to update it.
44
#ifndef JSON_VERSION_H_INCLUDED
@@ -8,7 +8,7 @@
88
# define JSONCPP_VERSION_MAJOR @JSONCPP_VERSION_MAJOR@
99
# define JSONCPP_VERSION_MINOR @JSONCPP_VERSION_MINOR@
1010
# define JSONCPP_VERSION_PATCH @JSONCPP_VERSION_PATCH@
11-
# define JSONCPP_VERSION_QUALIFIER @JSONCPP_VERSION_QUALIFIER@
11+
# define JSONCPP_VERSION_QUALIFIER
1212
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
1313

1414
#endif // JSON_VERSION_H_INCLUDED

0 commit comments

Comments
 (0)