CMake: Set version based on git tag

This commit is contained in:
TellowKrinkle 2022-04-11 03:14:48 -05:00 committed by tellowkrinkle
parent be05c95026
commit e1a6304e32
1 changed files with 4 additions and 1 deletions

View File

@ -57,7 +57,10 @@ function(get_git_version_info)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET)
endif()
if(PCSX2_GIT_REV)
if ("${PCSX2_GIT_TAG}" MATCHES "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)$")
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" PCSX2_VERSION_LONG "${PCSX2_GIT_TAG}")
string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" PCSX2_VERSION_SHORT "${PCSX2_GIT_TAG}")
elseif(PCSX2_GIT_REV)
set(PCSX2_VERSION_LONG "${PCSX2_GIT_REV}")
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?(-[a-z][a-z0-9]+)?" PCSX2_VERSION_SHORT "${PCSX2_VERSION_LONG}")
else()