在QT中从.pro编译完成后如何执行shell命令? [英] How to execute shell command after compile finished from .pro in QT?
问题描述
如果我想执行 chmod
命令、执行输出二进制文件或执行一些其他操作,我必须对 .pro
文件进行哪些更改.
What changes must I make to the .pro
file if I want to execute chmod
command, execute the output binary file, or do some other operations.
推荐答案
我遇到了类似的问题.我想要一个特殊的工具(版本控制程序)在每次执行 Makefile 时运行代码.解决方法如下:
I had a similar problem. I wanted a special tool (versioner) to run over the code every time the Makefile was executed. Here's the solution:
(在Qmake 中阅读手册,配置 qmake 的环境,部分:自定义 Makefile 输出)
创建您自己的 Makefile 目标.指定命令等
Create you own Makefile target. Specify the command etc.
mytarget.target = .buildfile
mytarget.commands = touch $$mytarget.target
QMAKE_EXTRA_TARGETS += mytarget
这样,您就有了一个额外的目标,您可以使用例如 make mytarget
调用.如果你想把它与实际的构建目标联系起来,你必须添加:
This way, you have an extra target you can call with make mytarget
for example. If you want to tie it together to the actual buildtarget you'll have to add:
POST_TARGETDEPS += mytarget
希望有所帮助.
最好的问候
这篇关于在QT中从.pro编译完成后如何执行shell命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!