开发者

How to overwrite the `make dist` default target of Qmake?

开发者 https://www.devze.com 2023-01-13 02:39 出处:网络
In a Qt project, I need to provide a custom make dist. So I added the following lines to the *.pro file:

In a Qt project, I need to provide a custom make dist. So I added the following lines to the *.pro file:

QMAKE_EXTRA_TARGETS += dist
dist.commands = [...]

That works, but shows the following warnings each time I run make:

Makefile:209: warning: overriding commands for target `dist'
Makefile:188: warning: ignoring old commands for target `dist'

Apart from that, it works pretty well and completely overwrites Qm开发者_开发技巧ake's default make dist target. But the warnings are really annoying.

I could use a different target name such as make dist-all, but make dist is an established standard command. Is it possible to overwrite Qmake's make dist without getting warnings?

Maybe I'm on the wrong track? Should I handle this issue in a different way?


the warning is generated by make not by qmake, because dist gets defined twice - which is not allowed. You can't redefine the dist target without recompiling qmake, because the dist target is hardcoded in qmake/generators/unix/unixmake.cpp

to solve the problem you could edit the makefile after it is generated by qmake (using a script for example that wrapps the qmake call and then removes the standard dist target)

or use another target-name like 'myDist'

0

精彩评论

暂无评论...
验证码 换一张
取 消