Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding custom target in qmake

I want to build my resources with qmake as follows [Qt 5.5]:

imageTarget.target = images.rcc
imageTarget.depends = $$PWD/images.qrc
imageTarget.commands = rcc -binary -no-compress $$PWD/images.qrc -o $$OUT_PWD/images.rcc
QMAKE_EXTRA_TARGETS += imageTarget

When I run qmake for my .pro file, it generates the make rule for target images.rcc target as expected:

images.rcc: /path/to/images.qrc
rcc -binary -no-compress /path/to/images.qrc -o /output/path/to/images.rcc

So far so good.

However, what I would expect is that running qmake would also generate the output file images.rcc and it does not.

But when I go into the makefile directory and type in the command "make images.rcc", then the images.rcc is generated. Am I missing a point? How can I make target in the qmake step without the need of extra make?

like image 664
OnurA Avatar asked Oct 16 '25 21:10

OnurA


1 Answers

With

QMAKE_EXTRA_TARGETS += imageTarget

you just define a new target - but it is not automatically built when running make.

Try to add

PRE_TARGETDEPS += images.rcc

This should automatically build a new images.rcc when running make if images.qrc has changed.

like image 86
Flopp Avatar answered Oct 18 '25 22:10

Flopp



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!