Qt. Automatically adding version for application

前端 未结 1 1507
甜味超标
甜味超标 2020-12-31 09:20

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

VERSION = 

Is there a way of doing this automatical

1条回答
  •  無奈伤痛
    2020-12-31 09:58

    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 . 
    VERSION = $$system(hg parents --template '{latesttag}.{latesttagdistance}')
    # or if you fill all 3 positions manually: ..
    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 ('+').

    0 讨论(0)
提交回复
热议问题