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. Custom build step for subprojects

Custom build step for subprojects

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
qt creatorbuild stepssubdirs
6 Posts 2 Posters 2.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.
  • M Offline
    M Offline
    massimo.cristofolini
    wrote on last edited by
    #1

    Hi, everyone!

    I have a Subdirs Project, where there are 2 subprojects: MyLib (static C++ library project), MyLibTest (console app that uses MyLib; depends on MyLib).
    I'd like to add custom pre-build steps that will automatically update the version file for modified projects.
    The idea is that:

    • if I modify the library, qmake will rebuild both MyLib and MyLibTest (depends on MyLib); both pre-build steps are executed; both version files will be updated.
    • if I modify MyLibTest only, qmake will rebuild MyLibTest only; only MyLibTest pre-build step will run; only MyLibTest version file will be updated.

    Looks like pre-build steps will run on whole Subdirs Project, so I can't do such thing.
    Any hints about how I can do this?

    Thanks
    MIX

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Something's not clear, are you changing the version number of your library/application somewhere ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Something's not clear, are you changing the version number of your library/application somewhere ?

        M Offline
        M Offline
        massimo.cristofolini
        wrote on last edited by
        #3

        @SGaist Well, as an example, I have a version.h file in both projects, with some defines that will be updated by an external tool. Something like

        // version.h
        #define MAJOR_VERSION 1
        #define MINOR_VERSION 2
        #define BUILD_VERSION 123
        

        The custom build step will call the external tool so that -before- running qmake BUILD_VERSION will be updated.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Why not use the VERSION variable in your .pro file ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          M 1 Reply Last reply
          0
          • SGaistS SGaist

            Why not use the VERSION variable in your .pro file ?

            M Offline
            M Offline
            massimo.cristofolini
            wrote on last edited by
            #5

            @SGaist Because I didn't know about it :) I'll made some test and look how it behave in both Windows and Linux.
            BTW, the question is still open. How to update VERSION on every build?

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Modifying the .pro file from the outside is not the correct idea. Since you only want to increment the build number you can mix both. VERSION from the pro file and build number generator that you can take inspiration from here

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              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