QtCreator:没有完整路径的Mercurial版本$$系统(hg ..)?

时间:2012-10-18 12:08:41

标签: qt mercurial qt-creator

Win 7上的Qt Creator 2.5.2:我正在使用这种方法(Qt. Automatically adding version for application)在Qt Creator中为我的源代码添加VERSION编号。

但是,由于我的Mercurial安装在C:\TortoiseHg\hg,我必须指定

VERSION = $$system(C:\TortoiseHg\hg parents --template '{latesttag}+{latesttagdistance}')

这条完整的路径不是很好,因为其他人可能已安装在不同的地方。该位置在Qt Creator工具下正确设置 - >选项 - >版本控制 - >水银。

是否有机会(变量)反映此设置或其他解决方法?猜猜为了使用VERSION = $$system(hg parents --template '{latesttag}+{latesttagdistance}'),我必须将C:\TortoiseHg\全局添加到PATH - 由于某些原因我想避免这种情况。

那么摆脱绝对路径的最佳方法是什么?

1 个答案:

答案 0 :(得分:1)

.pro文件不仅是QtCreator项目,而且qmake项目文件 - qmake可能不知道您在QtCreator设置中指定了什么。如果您不想将hg.exe的路径添加到PATH,则可能需要创建单独的环境变量,并尝试在$$system中使用它。