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. Qmake pre-build step before ANY compilation
Forum Updated to NodeBB v4.3 + New Features

Qmake pre-build step before ANY compilation

Scheduled Pinned Locked Moved Qt Creator and other tools
4 Posts 3 Posters 8.6k Views 1 Watching
  • 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.
  • C Offline
    C Offline
    cmannett85
    wrote on last edited by
    #1

    There are several questions on SO regarding how to create a pre-build step for qmake, I can do that with this in my .pro file:

    @versionTarget.target = ../VersionData/versioning.h
    versionTarget.depends = FORCE
    win32: versionTarget.commands = cd $$PWD; python.exe ./version_getter.py -p $$TARGET
    else: versionTarget.commands = cd $$PWD; python ./version_getter.py -p $$TARGET

    PRE_TARGETDEPS += ../VersionData/versioning.h
    QMAKE_EXTRA_TARGETS += versionTarget@

    Now, the problem is that this approach is not a build step per se but just another build target, so if I have the -j flag configured for make it runs my script in parallel with the other build jobs. This is very bad, because my script creates/updates a header file - having it change part way through the compilation is not acceptable.

    So, is there anyway I can have this script executed before any compilation is ran? I know I can create another script and call the version_getter.py and qmake in sequence from that, but this is not desirable as I would have to compile from the command line rather than from within Qt Creator.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      pritamghanghas
      wrote on last edited by
      #2

      can't you make your main target or all depend on versionTarget.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cmannett85
        wrote on last edited by
        #3

        Sorry I forgot to update this question, it was answered over at "SO":http://stackoverflow.com/questions/15864689/qmake-pre-build-step-before-any-compilation.

        1 Reply Last reply
        0
        • afyaA Offline
          afyaA Offline
          afya
          wrote on last edited by
          #4

          [http://stackoverflow.com/questions/35411144/automatic-build-version-in-qt](link url)

          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