Add full git commit to About dialog
This commit is contained in:
@@ -2,4 +2,9 @@ add_library(version STATIC "version.c")
|
||||
execute_process(COMMAND bash ./generate-version-string.sh
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_VER)
|
||||
target_compile_definitions(version PUBLIC PROJECT_GIT_VERSION=${GIT_VER})
|
||||
execute_process(COMMAND bash ./generate-git-commit-string.sh
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT)
|
||||
message("Commit: ${GIT_COMMIT}")
|
||||
message("Version: ${GIT_VER}")
|
||||
target_compile_definitions(version PRIVATE PROJECT_GIT_VERSION=${GIT_VER} PROJECT_GIT_COMMIT=${GIT_COMMIT})
|
||||
|
3
version/generate-git-commit-string.sh
Executable file
3
version/generate-git-commit-string.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
git rev-parse --verify HEAD | tr -d '\n'
|
||||
|
@@ -1 +1 @@
|
||||
git describe --tags --dirty
|
||||
git describe --tags --dirty | tr -d '\n'
|
||||
|
@@ -33,4 +33,12 @@ const char *_app_version_string = xstr(PROJECT_GIT_VERSION);
|
||||
const char *_app_version_string = "! version not set !";
|
||||
#endif
|
||||
|
||||
#ifdef PROJECT_GIT_COMMIT
|
||||
#define xstr(a) str(a)
|
||||
#define str(a) #a
|
||||
const char *_app_git_commit = xstr(PROJECT_GIT_COMMIT);
|
||||
#else
|
||||
const char *_app_git_commit = "! Commit hash not available !";
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
|
Reference in New Issue
Block a user