From QtCreator "projects - Add Building Step", one can specify added building steps. For example, the following setting will echo out a message when the project is built.
The added building step actually appears in the corresponding .pro.user file:
<value type="QString" key="ProjectExplorer.ProcessStep.Arguments">hello. This is my custom process step.</value>
<value type="QString" key="ProjectExplorer.ProcessStep.Command">/usr/bin/echo</value>
My question is: is there a way adding the building step in the .pro file instead of using the GUI ("projects - Add Building Step") and actually adding settings to .pro.user file? (To me, the advantage is that .pro files can be easily batch-processed with shell scripts.)
I tried to put the step in the .pro file with QMAKE_EXTRA_TARGETS as
mystep.commands = echo 'hello. This is my custom process step'
QMAKE_EXTRA_TARGETS += mystep
However, with qmake; make
from command line, only the original building happens. Only after a further make mystep
, the echo happens. In another words, mystep
step does not happen with a normal make
- maybe I am misunderstanding QMAKE_EXTRA_TARGETS
?
I'm glad you found an answer that works for you. I want to clarify the comment I made above, since I tried it and it worked fine for me. (And was much simpler looking than your solution.) I think the reason it didn't work for you was because I intended you to combine PRE_TARGETDEPS with the QMAKE_EXTRA_TARGETS you already had. This should be all you need.
mystep.commands = echo 'hello. This is my custom process step'
QMAKE_EXTRA_TARGETS += mystep
PRE_TARGETDEPS += mystep