Force QtCreator to run “qmake” when building

后端 未结 4 2146
猫巷女王i
猫巷女王i 2021-02-06 03:33

In some of my projects I use some pre-build step(s) configured in the .pro file. So qmake will execute this step whenever it is activated.

Now in QtCreator,

4条回答
  •  后悔当初
    2021-02-06 04:24

    Another dirty hack but a little more flexible: On Linux/Mac add "touch yourprojectfile.pro" as a build step or assign an external tool call to sth. like touch "*.pro" run in your current projects working directory. When the pro file is altered (which is mimicked by touch) qmake is executed. Not much cleaner but the external tool plus hotkey solution is more flexible than adding qmake into the buildsteps of each an every project.

    Update: I finally found a completely satisfactory solution for this. In the pro file add:

      qmakeforce.target = dummy
      qmakeforce.commands = rm -f Makefile ##to force rerun of qmake
      qmakeforce.depends = FORCE
      PRE_TARGETDEPS += $$qmakeforce.target
      QMAKE_EXTRA_TARGETS += qmakeforce
    

    This deletes the generated Makefile an thus forces qmake to rerun for every build.

提交回复
热议问题