Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    How does QtCreator know when to re-run qmake?

    Tools
    2
    5
    3403
    Loading More Posts
    • 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
      Lindley last edited by

      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 Reply Quote 0
      • L
        Lindley last edited by

        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 Reply Quote 0
        • L
          Lindley last edited by

          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 Reply Quote 0
          • L
            Lindley last edited by

            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 Reply Quote 0
            • D
              dbzhang800 last edited by

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

              1 Reply Last reply Reply Quote 0
              • First post
                Last post