summaryrefslogtreecommitdiffstats
path: root/version.pri
diff options
context:
space:
mode:
authorKari Oikarinen <kari.oikarinen@qt.io>2016-11-23 16:28:51 +0200
committerKari Oikarinen <kari.oikarinen@qt.io>2016-11-24 10:39:45 +0000
commitdb61153547cb8aafaf374f43932047ea400bd482 (patch)
treee74257a45c760a341030b2a61a5586eca9cc2209 /version.pri
parent9bee6b62958d8deb3ac26824f88fabd62eccb173 (diff)
Add --version option
Derive the version information with git-describe. It will use tags (once they exist) as a reference, but always includes (an abbreviated version) of the SHA1 so that finding the exact version is easy. Also show the used Qt version. A caveat is that since qmake is used, version is only updated after qmake is run and mains are compiled. This should not be a problem for real releases, since they will be built clean. Change-Id: I59e32f99c30a957d624eff0cf04a927328a08212 Reviewed-by: Samuli Piippo <samuli.piippo@qt.io>
Diffstat (limited to 'version.pri')
-rw-r--r--version.pri8
1 files changed, 8 insertions, 0 deletions
diff --git a/version.pri b/version.pri
new file mode 100644
index 0000000..9784944
--- /dev/null
+++ b/version.pri
@@ -0,0 +1,8 @@
+unix:system(which git): HAS_GIT = TRUE
+win32:system(where git.exe): HAS_GIT = TRUE
+contains(HAS_GIT, TRUE) {
+ GIT_VERSION = $$system(git describe --always --dirty --long --tags)
+}
+isEmpty(GIT_VERSION): GIT_VERSION = "(unknown version)"
+
+DEFINES += "QDB_VERSION=\\\"$$GIT_VERSION\\\""