build: use a tweak of 9999 when a valid version tag can not be found
loosely based on https:://github.com/deskflow/deskflow/pull/9303 where it was pointed out that using the gitrev as a fallback could create an invalid version
This commit is contained in:
parent
f8d9de1f2e
commit
16d35349d3
1 changed files with 17 additions and 28 deletions
|
|
@ -32,16 +32,6 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
|||
OUTPUT_VARIABLE GIT_SHA_SHORT
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-list --tags --count
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE GIT_TAG_COUNT
|
||||
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
if(${GIT_TAG_COUNT} EQUAL 0)
|
||||
set(DESKFLOW_VERSION_TWEAK "9999")
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} describe --long --match v* --always
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
|
|
@ -61,13 +51,12 @@ if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
|||
set(DESKFLOW_VERSION_MINOR ${MINOR})
|
||||
set(DESKFLOW_VERSION_PATCH ${PATCH})
|
||||
set(DESKFLOW_VERSION_TWEAK ${TWEAK})
|
||||
elseif(NOT ${GITREV} STREQUAL "")
|
||||
set(DESKFLOW_VERSION_TWEAK ${GITREV})
|
||||
else()
|
||||
set(DESKFLOW_VERSION_TWEAK "9999")
|
||||
endif()
|
||||
unset(GITREV)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#generate vcpkg file if needed
|
||||
if(WIN32)
|
||||
|
|
|
|||
Loading…
Reference in a new issue