Simplfying the Git commands in the project file

* Allowing commands to get the `GIT_COMMIT_ID`, `GIT_COMMIT_DATE` and `GIT_BRANCH` to work with spaces in path
This commit is contained in:
Chris 2022-12-08 13:57:16 +11:00
parent 86f0ab888d
commit d67acee002

View file

@ -43,9 +43,9 @@ TEMPLATE = app
#-----------------------------------------------------------------------------------------------#
win32:BUILDDATE = $$system(date /t)
unix:BUILDDATE = $$system(date -R -d "@${SOURCE_DATE_EPOCH:-$(date +%s)}")
GIT_COMMIT_ID = $$system(git --git-dir $$_PRO_FILE_PWD_/.git --work-tree $$_PRO_FILE_PWD_ rev-parse HEAD)
GIT_COMMIT_DATE = $$system(git --git-dir $$_PRO_FILE_PWD_/.git --work-tree $$_PRO_FILE_PWD_ show -s --format=%ci HEAD)
GIT_BRANCH = $$system(git --git-dir $$_PRO_FILE_PWD_/.git --work-tree $$_PRO_FILE_PWD_ rev-parse --abbrev-ref HEAD)
GIT_COMMIT_ID = $$system(git log -n 1 --pretty=format:"%H")
GIT_COMMIT_DATE = $$system(git log -n 1 --pretty=format:"%ci")
GIT_BRANCH = $$system(git branch --show-current)
DEFINES += \
VERSION_STRING=\\"\"\"$$VERSION\\"\"\" \