Retrieve build version [Solved]
-
wrote on 1 Feb 2011, 13:35 last edited by
hi,
this a "simple" question that strangely I didn't found anywhere else in this forum and Google too :
I need to display the build version of my software (like the one you got in the "about" dialog), please
indicate me what to do .PS : I found a blog that indicates to modify the .pro with a @Version=1.2.3@
to read it from main.cpp but that didn't worked for me -
wrote on 1 Feb 2011, 13:54 last edited by
maybe it will work:
.pro file:
@DEFINES += MYVERSION=1.2.1
VERSION = MYVERSION@and you also can use define MYVERSION in C++ code.
-
wrote on 1 Feb 2011, 13:55 last edited by
Displaying version information can be nasty. There are a few practices for this.
- Using preprocessor defines at build time
- Using a version header file (with defines), which can be versioned and updated by a version bump tool or automatically generated by a source control tool (especially useful for build or revision numbers)
- Using the .rc file on windows
- Whatever we can think of...
The VERSION thingy in the .pro file is mainly useful for a soname, but might (no experience) be used for your application as well.
The reason you cannot really find a lot of information on it is probably because handling version information hasn't been standardized in a cross-platform or generally applicable manner in any way.
-
wrote on 1 Feb 2011, 14:28 last edited by
first of all : thanks for your answers.
Alexander : this didn't worked for me with a read of VERSION from my main.Cpp
Franzk : I better understand why this is so hard, nevertheless why not about a "Qt-way" resource for that purpose. This is just a think anyway.
At last , the #define Version 1.2.3 is the same as the .pro modification (that didn't worked for me)
In fact, I really like to be a real auto-generated number, not one I did by hand : what do you call abq. version bump tool ?
-
wrote on 1 Feb 2011, 14:36 last edited by
As I know, VERSION in .pro file is used in symbian (when you install sis file).
You can use @define MYVERSION@ in C++ code.
For example, in our project, build system generates version.h file with @#define VESRION 1.1.0.svn revision number@
and all modules of our program use this define. -
wrote on 1 Feb 2011, 14:51 last edited by
this is really interesting as I mainly target symbian platform.
Nevertheless as I said, this is a manual versioning.
-
wrote on 1 Feb 2011, 15:00 last edited by
[quote author="doubitchou" date="1296570480"]what do you call a
bq. version bump tool ?[/quote]
It's usually a (custom) script that increases the version number, rewrites some file with the version definitions and creates a tag or label in the vcs (git, svn whatever). -
wrote on 1 Feb 2011, 15:21 last edited by
how :-( , thought there were some tools to do that for me (lazy I am).
-
wrote on 1 Feb 2011, 15:29 last edited by
Could still be, but then you'd have to invest some time in searching :P
-
wrote on 1 Feb 2011, 15:40 last edited by
exact, no better done than by myself.
A good idea would be to use QtCreator for that purpose :
- in the pre-build process configuration I'll add a call to a little soft that increment a version number
in a local file.
- in the pre-build process configuration I'll add a call to a little soft that increment a version number
1/10