Allow KeePassXC version overrides from file in addition to Git tags

This commit is contained in:
Janek Bevendorff 2018-02-22 21:31:32 +01:00
parent 69283e83d8
commit 3089894d20
2 changed files with 11 additions and 7 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ release*/
*.swp *.swp
.DS_Store .DS_Store
.version

View File

@ -80,19 +80,22 @@ set_property(CACHE KEEPASSXC_BUILD_TYPE PROPERTY STRINGS Snapshot Release PreRel
execute_process(COMMAND git tag --points-at HEAD execute_process(COMMAND git tag --points-at HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_TAG) OUTPUT_VARIABLE GIT_TAG)
if(GIT_TAG) if(NOT GIT_TAG AND EXISTS ${CMAKE_SOURCE_DIR}/.version)
string(REGEX REPLACE "\r?\n$" "" GIT_TAG "${GIT_TAG}") file(READ ${CMAKE_SOURCE_DIR}/.version OVERRIDE_VERSION)
endif()
if(GIT_TAG MATCHES "^[\\.0-9]+-(alpha|beta)[0-9]+$") string(REGEX REPLACE "(\r?\n)+" "" OVERRIDE_VERSION "${OVERRIDE_VERSION}")
if(OVERRIDE_VERSION)
if(OVERRIDE_VERSION MATCHES "^[\\.0-9]+-(alpha|beta)[0-9]+$")
set(KEEPASSXC_BUILD_TYPE PreRelease) set(KEEPASSXC_BUILD_TYPE PreRelease)
set(KEEPASSXC_VERSION ${GIT_TAG}) set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
elseif(GIT_TAG MATCHES "^[\\.0-9]+$") elseif(OVERRIDE_VERSION MATCHES "^[\\.0-9]+$")
set(KEEPASSXC_BUILD_TYPE Release) set(KEEPASSXC_BUILD_TYPE Release)
set(KEEPASSXC_VERSION ${GIT_TAG}) set(KEEPASSXC_VERSION ${OVERRIDE_VERSION})
endif() endif()
endif() endif()
if(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease" AND NOT GIT_TAG) if(KEEPASSXC_BUILD_TYPE STREQUAL "PreRelease" AND NOT OVERRIDE_VERSION)
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-preview") set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-preview")
elseif(KEEPASSXC_BUILD_TYPE STREQUAL "Snapshot") elseif(KEEPASSXC_BUILD_TYPE STREQUAL "Snapshot")
set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-snapshot") set(KEEPASSXC_VERSION "${KEEPASSXC_VERSION}-snapshot")