aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Gianluca Boiano <491117+M0Rf30@users.noreply.github.com>2022-06-24 12:27:54 +0200
committerLibravatar GitHub <noreply@github.com>2022-06-24 15:57:54 +0530
commit91d0cf1138ca52d4208aad49a753122b231d8a01 (patch)
treed082cfdf98cfe69d4f407bdc591ef3bd1205f7ad
parent200576754474cb02238faf3fef48e94fe3035eef (diff)
downloadwhatsie-91d0cf1138ca52d4208aad49a753122b231d8a01.tar.gz
whatsie-91d0cf1138ca52d4208aad49a753122b231d8a01.zip
chore(qmake): avoid error message when .git folder is missing (close #49) (#52)
-rw-r--r--src/WhatsApp.pro11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/WhatsApp.pro b/src/WhatsApp.pro
index 64342d0..8081769 100644
--- a/src/WhatsApp.pro
+++ b/src/WhatsApp.pro
@@ -39,10 +39,13 @@ DEFINES += QT_DEPRECATED_WARNINGS
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
# Define git info
-GIT_HASH="\\\"$$system(git -C \""$$_PRO_FILE_PWD_"\" rev-parse --short HEAD)\\\""
-GIT_BRANCH="\\\"$$system(git -C \""$$_PRO_FILE_PWD_"\" rev-parse --abbrev-ref HEAD)\\\""
-BUILD_TIMESTAMP="\\\"$$system(date -u +\""%Y-%m-%dT%H:%M:%SUTC\"")\\\""
-DEFINES += GIT_HASH=$$GIT_HASH GIT_BRANCH=$$GIT_BRANCH BUILD_TIMESTAMP=$$BUILD_TIMESTAMP
+exists(${QMAKE_FILE_PATH}/../.git) {
+ GIT_HASH="\\\"$$system(git -C \""$$_PRO_FILE_PWD_"\" rev-parse --short HEAD)\\\""
+ GIT_BRANCH="\\\"$$system(git -C \""$$_PRO_FILE_PWD_"\" rev-parse --abbrev-ref HEAD)\\\""
+ BUILD_TIMESTAMP="\\\"$$system(date -u +\""%Y-%m-%dT%H:%M:%SUTC\"")\\\""
+ DEFINES += GIT_HASH=$$GIT_HASH GIT_BRANCH=$$GIT_BRANCH BUILD_TIMESTAMP=$$BUILD_TIMESTAMP
+}
+
# Set program version
VERSION = 4.4