Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How does QtCreator know when to re-run qmake?
QtWS25 Last Chance

How does QtCreator know when to re-run qmake?

Scheduled Pinned Locked Moved Qt Creator and other tools
5 Posts 2 Posters 3.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lindley
    wrote on last edited by
    #1

    I am using QtCreator with qmake-based projects in a git repository. I'd like to use "git describe" to generate a version string, which is easy enough in qmake.

    However, qtcreator doesn't re-run qmake every time I build (nor should it). I would like to know if there is some way I can convince qtcreator to re-run qmake whenever the current git commit ID, branch, or tag changes.

    Any ideas?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Lindley
      wrote on last edited by
      #2

      One possible approach I've come up with is to install a git hook (post-commit, post-merge, post-checkout) to run "touch" on the .pro files. Ideally this would cause qmake to re-run after any change to the current git state.

      The problem is that git hooks aren't propagated by a clone, so it would be necessary to do something clever to make sure they get activated in every newly-cloned repo. Also, it's not obvious that this is the intended use for these hooks (or else they'd have a state-changed hook).

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Lindley
        wrote on last edited by
        #3

        Let me ask a slightly different, but related question.

        If you include(something.pri) in a pro file, then any changes to something.pri are detected by qtcreator and cause it to re-run qmake. Is include() the only qmake function that has this effect, or are there others? Is there a comprehensive list somewhere?

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Lindley
          wrote on last edited by
          #4

          I found a better solution:

          DEFINES += VERSION=$(shell git describe)

          This makes the actual "git describe" command be run by the Makefile instead of by qmake, skipping the need to re-run qmake.

          I am still interested in answers to the above question about how qtcreator decides qmake needs to be rerun, though.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dbzhang800
            wrote on last edited by
            #5

            Hi, qmake will be re-run when your .pro file changed.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved