Skip to content

Commit

Permalink
ci: fix master version generation
Browse files Browse the repository at this point in the history
  • Loading branch information
jahnf committed Oct 13, 2023
1 parent 372f5e8 commit 8990646
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cmake/modules/GitVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ function(get_version_info prefix directory)
math(EXPR CALCULATED_GIT_DISTANCE "${${prefix}_VERSION_DISTANCE}+${${prefix}_VERSION_DISTANCE_OFFSET}")
set(${prefix}_VERSION_DISTANCE ${CALCULATED_GIT_DISTANCE})
set(${prefix}_VERSION_DISTANCE ${CALCULATED_GIT_DISTANCE} PARENT_SCOPE)
message(STATUS "DISTANCE IS ${${prefix}_VERSION_DISTANCE}")

execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
RESULT_VARIABLE resultSH
Expand Down Expand Up @@ -321,15 +322,18 @@ function(get_version_info prefix directory)
if(NOT ${${prefix}_VERSION_PATCH} EQUAL 0)
set(VERSION_STRING "${VERSION_STRING}.${${prefix}_VERSION_PATCH}")
endif()
if(NOT ON_MASTER OR NOT ${${prefix}_VERSION_DISTANCE} EQUAL 0)
if(NOT ON_MASTER OR NOT ${${prefix}_VERSION_DISTANCE} EQUAL ${${prefix}_VERSION_DISTANCE_OFFSET})
set(VERSION_STRING "${VERSION_STRING}-${${prefix}_VERSION_FLAG}")
set(VERSION_STRING_FULL "${VERSION_STRING_FULL}-${${prefix}_VERSION_FLAG}")
endif()
if(NOT ${${prefix}_VERSION_FLAG} STREQUAL "")
set(VERSION_STRING "${VERSION_STRING}.")
set(VERSION_STRING_FULL "${VERSION_STRING_FULL}.")
endif()
if(NOT ON_MASTER OR (NOT ON_MASTER AND NOT ${${prefix}_VERSION_DISTANCE} EQUAL 0))
if(NOT ON_MASTER OR (NOT ON_MASTER AND NOT ${${prefix}_VERSION_DISTANCE} EQUAL ${${prefix}_VERSION_DISTANCE_OFFSET}))
set(VERSION_STRING "${VERSION_STRING}${${prefix}_VERSION_DISTANCE}")
set(VERSION_STRING_FULL "${VERSION_STRING_FULL}${${prefix}_VERSION_DISTANCE}")
elseif(ON_MASTER AND NOT ${${prefix}_VERSION_DISTANCE} EQUAL ${${prefix}_VERSION_DISTANCE_OFFSET})
set(VERSION_STRING "${VERSION_STRING}${${prefix}_VERSION_DISTANCE}")
set(VERSION_STRING_FULL "${VERSION_STRING_FULL}${${prefix}_VERSION_DISTANCE}")
endif()
Expand Down Expand Up @@ -390,7 +394,7 @@ function(add_version_info_custom_prefix target prefix directory)
set(VERSION_DISTANCE_OFFSET ${TARGET_VDIST_OFFSET})
endif()
set(${prefix}_VERSION_DISTANCE_OFFSET ${VERSION_DISTANCE_OFFSET})

include(ArchiveVersionInfo_${prefix} OPTIONAL RESULT_VARIABLE ARCHIVE_VERSION_PRESENT)
if(ARCHIVE_VERSION_PRESENT AND ${prefix}_VERSION_SUCCESS)
message(STATUS "Info: Version information from archive file.")
Expand Down

0 comments on commit 8990646

Please sign in to comment.