4
0
mirror of https://github.com/QuasarApp/CMake.git synced 2025-05-12 09:29:32 +00:00

added support for git

This commit is contained in:
Andrei Yankovich 2021-09-28 13:44:58 +03:00
parent a36c819e1d
commit 6ea41c92ea
2 changed files with 23 additions and 0 deletions

@ -13,3 +13,8 @@ The module provides qt utils functions. This module contains some useful functio
- sourceDir - This is root source directory. Update will be scan this dir for prepare translations.
- ts_files - This is list of the supported languages.
## CMake Variables
- The **GIT_COMMIT_COUNT** - This variable contains commits count
- The **GIT_COMMIT_HASH** - This variable contains short version of the buildet commit hash.

@ -11,6 +11,11 @@
# *********************
# The prepareQM function - This function prepare translations for you prijects
#**********************
# Availabel VARIABLE:
# *********************
# The GIT_COMMIT_COUNT variable - This variable contains commits count
# The GIT_COMMIT_HASH variable - This variable contains short version of the buildet commit hash.
if(DEFINED PROJECT_QT_UTILS_SUPPORT)
return()
@ -45,3 +50,16 @@ function(prepareQM name sourceDir ts_files)
endfunction()
execute_process(
COMMAND git rev-list --all --count
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_COUNT
)
string(STRIP "${GIT_COMMIT_COUNT}" GIT_COMMIT_COUNT)
execute_process(
COMMAND git rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
)
string(STRIP "${GIT_COMMIT_HASH}" GIT_COMMIT_HASH)