cmake: Add support for version suffixes

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2019-12-22 08:28:32 +01:00
parent a99030f5c0
commit 8c3979a3c2

View file

@ -23,12 +23,13 @@ set(VERSION_MAJOR 0)
set(VERSION_MINOR 7)
set(VERSION_PATCH 1)
set(VERSION_TWEAK 0)
set(VERSION_SUFFIX "")
set(PROJECT_COMMIT "N/A")
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git")
set(GIT_RESULT "")
set(GIT_OUTPUT "")
execute_process(
COMMAND git rev-list --count --topo-order ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}..HEAD
COMMAND git rev-list --count --topo-order ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}${VERSION_SUFFIX}..HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
RESULT_VARIABLE GIT_RESULT
OUTPUT_VARIABLE GIT_OUTPUT
@ -157,7 +158,7 @@ configure_file(
# Packaging
if("${CMAKE_PACKAGE_SUFFIX_OVERRIDE}" STREQUAL "")
set(_PACKAGE_SUFFIX_OVERRIDE "${PROJECT_VERSION}-${PROJECT_COMMIT}")
set(_PACKAGE_SUFFIX_OVERRIDE "${PROJECT_VERSION}${VERSION_SUFFIX}-${PROJECT_COMMIT}")
else()
set(_PACKAGE_SUFFIX_OVERRIDE "${CMAKE_PACKAGE_SUFFIX_OVERRIDE}")
endif()