mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-26 02:00:50 +08:00
generate both version.h and version from CMakelists.txt
This forces consistency, since they will be re-generated whenever a git operation alters CMakelists.txt. They are still in the repo because users might not actually run cmake.
This commit is contained in:
parent
2a840c105c
commit
295e73ff3c
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@
|
|||||||
/libs/
|
/libs/
|
||||||
/doc/doxyfile
|
/doc/doxyfile
|
||||||
/dist/
|
/dist/
|
||||||
|
#/version
|
||||||
#/include/json/version.h
|
#/include/json/version.h
|
||||||
|
|
||||||
# MSVC project files:
|
# MSVC project files:
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# vim: et ts=4 sts=4 sw=4 tw=0
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5)
|
||||||
PROJECT(jsoncpp)
|
PROJECT(jsoncpp)
|
||||||
ENABLE_TESTING()
|
ENABLE_TESTING()
|
||||||
@ -54,17 +56,24 @@ MACRO(jsoncpp_parse_version VERSION_TEXT OUPUT_PREFIX)
|
|||||||
ENDMACRO(jsoncpp_parse_version)
|
ENDMACRO(jsoncpp_parse_version)
|
||||||
|
|
||||||
# Read out version from "version" file
|
# Read out version from "version" file
|
||||||
FILE(STRINGS "version" JSONCPP_VERSION)
|
#FILE(STRINGS "version" JSONCPP_VERSION)
|
||||||
|
#SET( JSONCPP_VERSION_MAJOR X )
|
||||||
|
#SET( JSONCPP_VERSION_MINOR Y )
|
||||||
|
#SET( JSONCPP_VERSION_PATCH Z )
|
||||||
|
SET( JSONCPP_VERSION 1.5.2 )
|
||||||
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")
|
# 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}")
|
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"
|
||||||
|
NEWLINE_STYLE UNIX )
|
||||||
|
CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/version.in"
|
||||||
|
"${PROJECT_SOURCE_DIR}/version"
|
||||||
|
NEWLINE_STYLE UNIX )
|
||||||
|
|
||||||
macro(UseCompilationWarningAsError)
|
macro(UseCompilationWarningAsError)
|
||||||
if ( MSVC )
|
if ( MSVC )
|
||||||
|
1
version.in
Normal file
1
version.in
Normal file
@ -0,0 +1 @@
|
|||||||
|
@JSONCPP_VERSION@
|
Loading…
x
Reference in New Issue
Block a user