Hi @raven-worx ,
Thanks again, I've got it working the way I want, though I had to do some extra things.
For completeness and others:
What happens is that if I use your example, the listing.qrc file is created the first time, and not on every build. If I use a fake file as output, the custom compiler is executed everytime, however, when the listing.qrc already exists, and due to not being the output it is probably?? not seen as a pre-target for RCC so it is executed before the custom compiler.
I've tried to add a depends_command or a dependency to a custom target in which I remove the file. Removal of the file works, but now the custom compiler is stuck in a loop it seems. Not entirely sure why.
What seems to work, is to have the files for the custom command explicitly listed in the input, which even makes sense, no input file change, no need to build. But, since the files are created outside the QT project, I do not have a full/explicit listing.
Using $$files(path/*, true) works to get the listing, but now there are many warnings like:
Makefile:1379: warning: overriding commands for target `../../Project/ui/ui.web/listing.qrc'
Makefile:1376: warning: ignoring old commands for target `../../Project/ui/ui.web/listing.qrc'
To get rid of this warning I added the combine option, since there are many inputs but only one output, which again makes sense.
So now I have a setup which only executes the custom command if the input files have changes, or if the output file is missing.
The resulting qmake lines:
npmcompiler.name = NPM Compiler
npmcompiler.input = WEBFILES
npmcompiler.commands = pushd $$PWD; npm run-script build -- --prod --base-href \"/ui/\"; popd
npmcompiler.output = $$PWD/listing.qrc
npmcompiler.CONFIG += combine ignore_no_exist no_link no_clean target_predeps
QMAKE_EXTRA_COMPILERS += npmcompiler
WEBFILES = $$files($$PWD/src/*, true)