Skip to content

Commit

Permalink
VersionInfo: Mimic github's hash styling
Browse files Browse the repository at this point in the history
  • Loading branch information
tresf committed Feb 8, 2025
1 parent c81d497 commit cd06159
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmake/modules/VersionInfo.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ IF(GIT_FOUND AND NOT FORCE_VERSION)
LIST(GET TAG_LIST 2 COMMIT_HASH)
list(APPEND PRERELEASE_DATA "${EXTRA_COMMITS}")
list(APPEND BUILD_METADATA "${COMMIT_HASH}")
# Mimic github's hash style
STRING(SUBSTRING "${COMMIT_HASH}" 1 7 COMMIT_HASH)
# Bump the patch version, since a pre-release (as specified by the extra
# commits) compares lower than the main version alone
MATH(EXPR PATCH_VERSION "${PATCH_VERSION}+1")
Expand All @@ -58,6 +60,8 @@ IF(GIT_FOUND AND NOT FORCE_VERSION)
LIST(GET TAG_LIST 1 VERSION_STAGE)
LIST(GET TAG_LIST 2 EXTRA_COMMITS)
LIST(GET TAG_LIST 3 COMMIT_HASH)
# Mimic github's hash style
STRING(SUBSTRING "${COMMIT_HASH}" 1 7 COMMIT_HASH)
list(APPEND PRERELEASE_DATA "${VERSION_STAGE}")
list(APPEND PRERELEASE_DATA "${EXTRA_COMMITS}")
list(APPEND BUILD_METADATA "${COMMIT_HASH}")
Expand Down

0 comments on commit cd06159

Please sign in to comment.