Add ability to get version from envvar

main
Joel Smith 2020-07-14 13:42:23 -07:00
parent 7b5d4baffd
commit 929d852315
1 changed files with 20 additions and 4 deletions

View File

@ -10,10 +10,26 @@ CONFIG += c++11
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
# App version number
VERSION_TAG_PLAIN = $$getenv(TAG)
equals(VERSION_TAG_PLAIN, "") {
message(No Tag specified. Check if TAG environment variable is set.)
VERSION_TAG_PLAIN = Unknown-Version
}
VERSION_COMMIT_HASH_PLAIN = $$getenv(COMMIT_SHA)
equals(VERSION_COMMIT_HASH_PLAIN, "") {
message("No commit hash specified. Check if COMMIT_SHA environment variable is set.")
VERSION_COMMIT_HASH_PLAIN = Unknown-SHA
}
VERSION_TAG=\\\"$$VERSION_TAG_PLAIN\\\"
VERSION_COMMIT_HASH = \\\"$$VERSION_COMMIT_HASH_PLAIN\\\"
message(Building version [$$VERSION_TAG_PLAIN] using commit [$$VERSION_COMMIT_HASH_PLAIN])
DEFINES += "VERSION_TAG=$$VERSION_TAG"\
"VERSION_COMMIT_HASH=$$VERSION_COMMIT_HASH"
INCLUDEPATH += src