mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-04-21 21:52:03 +02:00

Currently, the user-facing version number in the about dialog, is a build-time timestamp that does help us isolate the project versions accurately. Ultimately, we need to be able to reproduce issues present in specific versions of Jami. This commit introduces a new version number in the form: <client_sha>.<jamicore_sha>, allowing us to reproduce builds more accurately. Gitlab: #1820 Change-Id: Ie7e20b20da65284e33e745996c410f539b65080c
34 lines
1.3 KiB
CMake
34 lines
1.3 KiB
CMake
find_package(Git QUIET REQUIRED)
|
|
|
|
message(STATUS "Generating version information...")
|
|
|
|
function(configure_version_string SOURCE_DIR VERSION_STRING_OUT)
|
|
# Get short git SHA
|
|
execute_process(
|
|
COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
|
|
WORKING_DIRECTORY "${SOURCE_DIR}"
|
|
OUTPUT_VARIABLE _GIT_SHA
|
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
|
)
|
|
|
|
# Output the VERSION_STRING_OUT to the caller
|
|
set(${VERSION_STRING_OUT} "${_GIT_SHA}" PARENT_SCOPE)
|
|
endfunction()
|
|
|
|
# These need to be set to the parent scripts values for configure_file to work,
|
|
# as it prepends CMAKE_CURRENT_SOURCE_DIR to the <input> and CMAKE_CURRENT_BINARY_DIR
|
|
# to <output>.
|
|
set(CMAKE_CURRENT_SOURCE_DIR ${APP_SOURCE_DIR})
|
|
set(CMAKE_CURRENT_BINARY_DIR ${APP_BINARY_DIR})
|
|
|
|
# Generate the version string for the application and core
|
|
configure_version_string(${APP_SOURCE_DIR} APP_VERSION_STRING)
|
|
configure_version_string(${CORE_SOURCE_DIR} CORE_VERSION_STRING)
|
|
|
|
# Get output file names with the .in extension removed
|
|
get_filename_component(VERSION_CPP_FILENAME ${CPP_INT_FILE} NAME_WE)
|
|
set(VERSION_CPP_FILE "${CMAKE_CURRENT_BINARY_DIR}/${VERSION_CPP_FILENAME}.cpp")
|
|
|
|
message(STATUS "infiles: ${CPP_INT_FILE}")
|
|
message(STATUS "outfiles: ${VERSION_CPP_FILE}")
|
|
configure_file(${CPP_INT_FILE} ${VERSION_CPP_FILE})
|