Skip to content

Commit d9ced92

Browse files
committed
Merge branch 'no-version'
We can modify version.h directly, as desired. It is retained for backward-compatibility, in case anyone is using those macros. Note: I have not modified SConstruct since that is deprecated, so I have retained the `version` file, which should be ignored. Addresses issue open-source-parsers#38
2 parents d2fa664 + 8f730b8 commit d9ced92

File tree

4 files changed

+14
-34
lines changed

4 files changed

+14
-34
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@
1010
/libs/
1111
/doc/doxyfile
1212
/dist/
13-
/include/json/version.h

CMakeLists.txt

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,38 +30,6 @@ FUNCTION(set_using_dynamic_name VAR_NAME VALUE)
3030
SET( "${VAR_NAME}" "${VALUE}" PARENT_SCOPE)
3131
ENDFUNCTION(set_using_dynamic_name)
3232

33-
# Extract major, minor, patch and qualifier from version text
34-
# Parse a version string "X.Y.Z[-qualifier]" and outputs
35-
# version parts in ${OUPUT_PREFIX}_MAJOR, _MINOR, _PATCH, _QUALIFIER.
36-
# If parse succed then ${OUPUT_PREFIX}_FOUND is TRUE.
37-
MACRO(jsoncpp_parse_version VERSION_TEXT OUPUT_PREFIX)
38-
SET(VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?")
39-
IF( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
40-
STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${VERSION_TEXT})
41-
list(APPEND VERSION_PARTS "") # empty qualifier to handle no qualifier case
42-
LIST(GET VERSION_PARTS 0 ${OUPUT_PREFIX}_MAJOR)
43-
LIST(GET VERSION_PARTS 1 ${OUPUT_PREFIX}_MINOR)
44-
LIST(GET VERSION_PARTS 2 ${OUPUT_PREFIX}_PATCH)
45-
LIST(GET VERSION_PARTS 3 ${OUPUT_PREFIX}_QUALIFIER)
46-
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" TRUE )
47-
ELSE( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
48-
set_using_dynamic_name( "${OUPUT_PREFIX}_FOUND" FALSE )
49-
ENDIF( ${VERSION_TEXT} MATCHES ${VERSION_REGEX} )
50-
ENDMACRO(jsoncpp_parse_version)
51-
52-
# Read out version from "version" file
53-
FILE(STRINGS "version" JSONCPP_VERSION)
54-
55-
jsoncpp_parse_version( ${JSONCPP_VERSION} JSONCPP_VERSION )
56-
IF(NOT JSONCPP_VERSION_FOUND)
57-
MESSAGE(FATAL_ERROR "Failed to parse version string properly. Expect X.Y.Z[-qualifier]")
58-
ENDIF(NOT JSONCPP_VERSION_FOUND)
59-
60-
MESSAGE(STATUS "JsonCpp Version: ${JSONCPP_VERSION_MAJOR}.${JSONCPP_VERSION_MINOR}.${JSONCPP_VERSION_PATCH}${JSONCPP_VERSION_QUALIFIER}")
61-
# File version.h is only regenerated on CMake configure step
62-
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/src/lib_json/version.h.in"
63-
"${PROJECT_SOURCE_DIR}/include/json/version.h" )
64-
6533
macro(UseCompilationWarningAsError)
6634
if ( MSVC )
6735
# Only enabled in debug because some old versions of VS STL generate

include/json/version.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// DO NOT EDIT. This file is generated by CMake from "version"
2+
// and "version.h.in" files.
3+
// Run CMake configure step to update it.
4+
#ifndef JSON_VERSION_H_INCLUDED
5+
# define JSON_VERSION_H_INCLUDED
6+
7+
# define JSONCPP_VERSION_STRING "0.6.0-dev"
8+
# define JSONCPP_VERSION_MAJOR 0
9+
# define JSONCPP_VERSION_MINOR 6
10+
# define JSONCPP_VERSION_PATCH 0
11+
# define JSONCPP_VERSION_QUALIFIER -dev
12+
# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8))
13+
14+
#endif // JSON_VERSION_H_INCLUDED

src/lib_json/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ ADD_LIBRARY( jsoncpp_lib ${JSONCPP_LIB_TYPE}
3434
json_valueiterator.inl
3535
json_value.cpp
3636
json_writer.cpp
37-
version.h.in
3837
)
3938
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES OUTPUT_NAME jsoncpp )
4039
SET_TARGET_PROPERTIES( jsoncpp_lib PROPERTIES VERSION ${JSON_CPP_VERSION} SOVERSION ${JSON_CPP_VERSION} )

0 commit comments

Comments
 (0)