Skip to content

Commit

Permalink
Fix support for _ as version delimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
CraigHutchinson committed Dec 9, 2022
1 parent ae5de8d commit 38de0df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CMake/Version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ endif()

# Git describe
# @note Exclude 'tweak' tags in the form v0.1.2-30 i.e. with the '-30' to avoid a second suffix being appended e.g v0.1.2-30-12
set(GIT_VERSION_COMMAND "${GIT_EXECUTABLE}" -C "${VERSION_SOURCE_DIR}" --no-pager describe --tags --exclude "v[0-9]*.[0-9]*.[0-9]*-[0-9]*" --always --dirty --long)
set(GIT_VERSION_COMMAND "${GIT_EXECUTABLE}" -C "${VERSION_SOURCE_DIR}" --no-pager describe --tags --exclude "v[0-9]*[._][0-9]*[._][0-9]*-[0-9]*" --always --dirty --long)

# Git count
# @note We only count commits on the current branch and not comits in merge branches via '--first-parent'. The count is never unique but the Sha will be!
Expand All @@ -40,7 +40,7 @@ set(GIT_COUNT_COMMAND "${GIT_EXECUTABLE}" -C "${VERSION_SOURCE_DIR}" rev-list --
set(GIT_CACHE_PATH_COMMAND "${GIT_EXECUTABLE}" -C "${VERSION_SOURCE_DIR}" rev-parse --git-dir)

macro(version_parseSemantic semVer)
if( "${semVer}" MATCHES "^v?([0-9]+)[.]([0-9]+)[.]?([0-9]+)?[-]([0-9]+)[-][g]([.0-9A-Fa-f]+)[-]?(dirty)?$")
if( "${semVer}" MATCHES "^v?([0-9]+)[._]([0-9]+)[._]?([0-9]+)?[-]([0-9]+)[-][g]([._0-9A-Fa-f]+)[-]?(dirty)?$")
set( _VERSION_SET TRUE)
math( EXPR _VERSION_MAJOR "${CMAKE_MATCH_1}+0")
math( EXPR _VERSION_MINOR "${CMAKE_MATCH_2}+0")
Expand Down

0 comments on commit 38de0df

Please sign in to comment.