June 17, 2011

yan bellavance yan bellavance
Lab Rat
50 posts

[SOLVED] Automatically increment a build number


I need to display the version of the software I am building. It will have the following nomenclature: majorVersion.MinorVersion.BuildNumber

Any ideas on how I can increment a build number each time I build and how I can access this value from the program at run time?

3 replies

June 18, 2011

Gerolf Gerolf
Hobby Entomologist
3251 posts

you can have a look at this gitorious project: auto incr build nr [gitorious.org] and at this [gitorious.org] pro file, the tool is used there.


Nokia Certified Qt Specialist.
Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

June 20, 2011

silver47 silver47
Lab Rat
20 posts

I created my own program, which increase build number in main.cpp file. Build number has such format:

  1. 01 #define BUILDCOUNTER 825

I added a new build step in Project Options, which increase number after successful build.


sorry for my english :(

July 21, 2011

yan bellavance yan bellavance
Lab Rat
50 posts

I ended up adding these lines to the .pro file:

buildNo.commands = ./buildNoScript
PRE_TARGETDEPS += buildNo # adding this removes the necessity to use .target

Then I made a simple script called buildNoScript that calls a small program that updates build info in a file (it reads the build no from that file first then increments it and writes it back).

  ‹‹ [SOLVED] [QComboBox and PSQL] Access PK from another column in the table      About QProcess::pid() function ››

You must log in to post a reply. Not a member yet? Register here!