Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Best way to set up version information?

Best way to set up version information?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 716 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.
  • K Offline
    K Offline
    kitfox
    wrote on last edited by
    #1

    I'm writing an editor program that is going to be able to write files. When I save my file, I would like to include a bit of information indicating the current version of my editor, as well as the build timestamp. While I could put this information in a #define in a header file, it seems to me this would be easy to overlook. Is there some other way to do this? Perhaps have the build process generate a header or resource file that contained my version and build info?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jerry.Wilson
      wrote on last edited by
      #2

      @kitfox said in Best way to set up version information?:

      I'm writing an editor program that is going to be able to write files. When I save my file, I would like to include a bit of information indicating the current version of my editor, as well as the build timestamp. While I could put this information in a #define in a header file, it seems to me this would be easy to overlook. Is there some other way to do this? Perhaps have the build process generate a header or resource file that contained my version and build info?

      DATE and TIME?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kitfox
        wrote on last edited by
        #3

        __DATE__ and __TIME__ will produce different binaries when compiling the same code, so it's best to avoid them. Also, I'd like a major.minor.commit_number version format, or something similar. It would be best if the build process could somehow generate the files I need before the compile starts.

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

          Hi,

          You can use the QMAKE_SUBSTITUTES variable and pass it a list of template files (for example version.h.in) and in this file you can use all the variables you define in your .pro file. The output file will be generated in your build folder.

          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
          2

          • Login

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