In a .pro
文件,我可以设置应用程序的版本,例如:
VERSION = <some version>
有没有办法自动执行此操作(例如从 Mercurial 获取值)?
如果可以从 shell 命令获取版本,则可以使用以下命令将其分配给变量$$system
qmake 函数。
因此,对于 Mercurial,您可以尝试:
# 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}')
或者,如果您使用本地修订号作为版本:
VERSION = $$system(hg parents --template '{rev}')
它将仅打印该数字,而没有未提交的更改指示符(“+”)。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)