1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 12:51:49 -05:00

cmake: sdrangel_VERSION_SUFFIX add the number of commits from last tag

Example:

SDRangel Version: 4.8.0-53-gc24a37d01
This commit is contained in:
Davide Gerhard 2019-05-22 09:52:36 +02:00
parent c24a37d011
commit e29500fc6d
No known key found for this signature in database
GPG Key ID: 7CBEFA144857DC97

View File

@ -55,14 +55,15 @@ add_definitions("-DIDENTIFIER=\"${IDENTIFIER}\"")
find_package(Git) find_package(Git)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/") if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git/")
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE res RESULT_VARIABLE res
OUTPUT_VARIABLE out OUTPUT_VARIABLE out
ERROR_QUIET ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE) OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT res) if(NOT res)
set(sdrangel_VERSION_SUFFIX "-${out}") string(REGEX REPLACE "^v([0-9]+)\.([0-9]+)\.([0-9]+)-" "" git_commit ${out})
set(sdrangel_VERSION_SUFFIX "-${git_commit}")
endif() endif()
endif() endif()