Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt. Automatically adding version for application

Tags:

qt

qmake

In a .pro file, I can set version of application such:

VERSION = <some version>

Is there a way of doing this automatically (e.g. getting the value from Mercurial)?

like image 312
synacker Avatar asked May 11 '12 10:05

synacker


1 Answers

If you can get the version from a shell command, you can assign it to the variable with the $$system qmake function.

So, for mercurial, you could try:

# if the version tag is <major version>.<minor version> 
VERSION = $$system(hg parents --template '{latesttag}.{latesttagdistance}')
# or if you fill all 3 positions manually: <major>.<minor>.<patchset>
VERSION = $$system(hg parents --template '{latesttag}')

Or if you are using the local revision number as the version:

VERSION = $$system(hg parents --template '{rev}')

which will only print that number without the uncommitted change indicator ('+').

like image 142
alexisdm Avatar answered Nov 15 '22 07:11

alexisdm