mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-27 11:21:02 +08:00
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.
This commit is contained in:
parent
ba330893d7
commit
0375af2eb5
@ -31,19 +31,17 @@ FUNCTION(set_using_dynamic_name VAR_NAME VALUE)
|
|||||||
SET( "${VAR_NAME}" "${VALUE}" PARENT_SCOPE)
|
SET( "${VAR_NAME}" "${VALUE}" PARENT_SCOPE)
|
||||||
ENDFUNCTION(set_using_dynamic_name)
|
ENDFUNCTION(set_using_dynamic_name)
|
||||||
|
|
||||||
# Extract major, minor, patch and qualifier from version text
|
# Extract major, minor, patch from version text
|
||||||
# Parse a version string "X.Y.Z[-qualifier]" and outputs
|
# Parse a version string "X.Y.Z" and outputs
|
||||||
# version parts in ${OUPUT_PREFIX}_MAJOR, _MINOR, _PATCH, _QUALIFIER.
|
# version parts in ${OUPUT_PREFIX}_MAJOR, _MINOR, _PATCH.
|
||||||
# If parse succeeds then ${OUPUT_PREFIX}_FOUND is TRUE.
|
# If parse succeeds then ${OUPUT_PREFIX}_FOUND is TRUE.
|
||||||
MACRO(jsoncpp_parse_version VERSION_TEXT OUPUT_PREFIX)
|
MACRO(jsoncpp_parse_version VERSION_TEXT OUPUT_PREFIX)
|
||||||
SET(VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?")
|
SET(VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?")
|
||||||
IF( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
|
IF( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
|
||||||
STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${VERSION_TEXT})
|
STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${VERSION_TEXT})
|
||||||
list(APPEND VERSION_PARTS "") # empty qualifier to handle no qualifier case
|
|
||||||
LIST(GET VERSION_PARTS 0 ${OUPUT_PREFIX}_MAJOR)
|
LIST(GET VERSION_PARTS 0 ${OUPUT_PREFIX}_MAJOR)
|
||||||
LIST(GET VERSION_PARTS 1 ${OUPUT_PREFIX}_MINOR)
|
LIST(GET VERSION_PARTS 1 ${OUPUT_PREFIX}_MINOR)
|
||||||
LIST(GET VERSION_PARTS 2 ${OUPUT_PREFIX}_PATCH)
|
LIST(GET VERSION_PARTS 2 ${OUPUT_PREFIX}_PATCH)
|
||||||
LIST(GET VERSION_PARTS 3 ${OUPUT_PREFIX}_QUALIFIER)
|
|
||||||
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" TRUE )
|
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" TRUE )
|
||||||
ELSE( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
|
ELSE( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
|
||||||
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" FALSE )
|
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" FALSE )
|
||||||
@ -55,10 +53,10 @@ FILE(STRINGS "version" JSONCPP_VERSION)
|
|||||||
|
|
||||||
jsoncpp_parse_version( ${JSONCPP_VERSION} JSONCPP_VERSION )
|
jsoncpp_parse_version( ${JSONCPP_VERSION} JSONCPP_VERSION )
|
||||||
IF(NOT JSONCPP_VERSION_FOUND)
|
IF(NOT JSONCPP_VERSION_FOUND)
|
||||||
MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z[-qualifier]")
|
MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z")
|
||||||
ENDIF(NOT JSONCPP_VERSION_FOUND)
|
ENDIF(NOT JSONCPP_VERSION_FOUND)
|
||||||
|
|
||||||
MESSAGE(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}${JSONCPP_VERSION_QUALIFIER}")
|
MESSAGE(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}")
|
||||||
# File version.h is only regenerated on CMake configure step
|
# File version.h is only regenerated on CMake configure step
|
||||||
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/lib_json/version.h.in"
|
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/lib_json/version.h.in"
|
||||||
"${PROJECT_SOURCE_DIR}/include/json/version.h" )
|
"${PROJECT_SOURCE_DIR}/include/json/version.h" )
|
||||||
|
@ -2,15 +2,13 @@
|
|||||||
// and "version.h.in" files.
|
// and "version.h.in" files.
|
||||||
// Run CMake configure step to update it.
|
// Run CMake configure step to update it.
|
||||||
#ifndef JSON_VERSION_H_INCLUDED
|
#ifndef JSON_VERSION_H_INCLUDED
|
||||||
#define JSON_VERSION_H_INCLUDED
|
# define JSON_VERSION_H_INCLUDED
|
||||||
|
|
||||||
#define JSONCPP_VERSION_STRING "0.7.0"
|
# define JSONCPP_VERSION_STRING "0.7.0"
|
||||||
#define JSONCPP_VERSION_MAJOR 0
|
# define JSONCPP_VERSION_MAJOR 0
|
||||||
#define JSONCPP_VERSION_MINOR 7
|
# define JSONCPP_VERSION_MINOR 7
|
||||||
#define JSONCPP_VERSION_PATCH 0
|
# define JSONCPP_VERSION_PATCH 0
|
||||||
#define JSONCPP_VERSION_QUALIFIER
|
# define JSONCPP_VERSION_QUALIFIER
|
||||||
#define JSONCPP_VERSION_HEXA \
|
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
|
||||||
((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | \
|
|
||||||
(JSONCPP_VERSION_PATCH << 8))
|
|
||||||
|
|
||||||
#endif // JSON_VERSION_H_INCLUDED
|
#endif // JSON_VERSION_H_INCLUDED
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// DO NOT EDIT. This file is generated by CMake from "version"
|
// DO NOT EDIT. This file is generated by CMake from "version"
|
||||||
// and "version.h.in" files.
|
// and "version.h.in" files.
|
||||||
// Run CMake configure step to update it.
|
// Run CMake configure step to update it.
|
||||||
#ifndef JSON_VERSION_H_INCLUDED
|
#ifndef JSON_VERSION_H_INCLUDED
|
||||||
@ -8,7 +8,7 @@
|
|||||||
# define JSONCPP_VERSION_MAJOR @JSONCPP_VERSION_MAJOR@
|
# define JSONCPP_VERSION_MAJOR @JSONCPP_VERSION_MAJOR@
|
||||||
# define JSONCPP_VERSION_MINOR @JSONCPP_VERSION_MINOR@
|
# define JSONCPP_VERSION_MINOR @JSONCPP_VERSION_MINOR@
|
||||||
# define JSONCPP_VERSION_PATCH @JSONCPP_VERSION_PATCH@
|
# define JSONCPP_VERSION_PATCH @JSONCPP_VERSION_PATCH@
|
||||||
# define JSONCPP_VERSION_QUALIFIER @JSONCPP_VERSION_QUALIFIER@
|
# define JSONCPP_VERSION_QUALIFIER
|
||||||
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
|
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
|
||||||
|
|
||||||
#endif // JSON_VERSION_H_INCLUDED
|
#endif // JSON_VERSION_H_INCLUDED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user