Commit 9c9abf31 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] extended version string and corresponding parser in cmake to allow...

[CHANGE] extended version string and corresponding parser in cmake to allow arbitrary tags in the version string.
parent b30b60b6
# OW Version File. This file specifies the version. The line VERSION=X.Y.Z is # OW Version File. This file specifies the version. The line VERSION=X.Y.Z is
# used and parsed. This file has to be here everytime. The VERSION needs to be # used and parsed. This file has to be here every time. The VERSION needs to be
# set properly or CMake will fail. # set properly or CMake will fail.
# #
# SYNTAX: The version string always is 1.2.3 with an optional postfix of "+hg1234". # SYNTAX: The version string always is 1.2.3 with an optional postfix of "+hg1234".
# This is useful if building is done by scripts. If you want to automatically # This is useful if building is done by scripts. If you want to automatically
# add the correct HG revision, use only +hgX without number. # add the correct HG revision, use only +hgX without number.
# You can optionally add underscore separated tags. The allowed characters in
# these tags are letters and numbers and you must begin with a letter.
# See examples below.
# #
# IMPORTANT: If you modify the file, cmake re-creates the version header. But # IMPORTANT: If you modify the file, cmake re-creates the version header. But
# it is not able to set all library version. Please re-run cmake if # it is not able to set all library version. Please re-run cmake if
# you change something here. # you change something here.
# #
# NOTE: do not add a space after #. The current CMake script will fail.
# Examples: # Examples:
#VERSION=1.2.0 # VERSION=1.2.0
#VERSION=1.2.0+hgX -> replaces the X with the current revision number # VERSION=1.2.0+hgX -> replaces the X with the current revision number
#VERSUIB=1.2.0+hg1234 -> here, revision number was set by the build scripts for example. # VERSION=1.2.0+hg1234 -> here, revision number was set by the build scripts for example.
# VERSION=1.2.0_RC1_PreRelease_SomeText+hgX -> You can add arbitrary tags to the version string. But be careful. Usually only one tag is useful.
# The current version string:
VERSION=1.3.0+hgX VERSION=1.3.0+hgX
...@@ -535,7 +535,7 @@ FUNCTION( GET_VERSION_STRING _version _api_version ) ...@@ -535,7 +535,7 @@ FUNCTION( GET_VERSION_STRING _version _api_version )
# Read the version file # Read the version file
FILE( READ ${OW_VERSION_FILENAME} OW_VERSION_FILE_CONTENT ) FILE( READ ${OW_VERSION_FILENAME} OW_VERSION_FILE_CONTENT )
# The first regex will mathc # The first regex will mathc
STRING( REGEX REPLACE ".*[^#]VERSION=([0-9]+\\.[0-9]+\\.[0-9]+(\\+hgX?[0-9]*)?).*" "\\1" OW_VERSION_FILE ${OW_VERSION_FILE_CONTENT} ) STRING( REGEX REPLACE ".*[^#]VERSION=([0-9]+\\.[0-9]+\\.[0-9]+[_a-z,A-Z,0-9]*(\\+hgX?[0-9]*)?).*" "\\1" OW_VERSION_FILE ${OW_VERSION_FILE_CONTENT} )
STRING( COMPARE EQUAL ${OW_VERSION_FILE} ${OW_VERSION_FILE_CONTENT} OW_VERSION_FILE_INVALID ) STRING( COMPARE EQUAL ${OW_VERSION_FILE} ${OW_VERSION_FILE_CONTENT} OW_VERSION_FILE_INVALID )
IF( OW_VERSION_FILE_INVALID ) IF( OW_VERSION_FILE_INVALID )
UNSET( OW_VERSION_FILE ) UNSET( OW_VERSION_FILE )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment