[Qt-interest] QMake hack to create compile-tme 'build version' string

Manner Robert rmanni at gmail.com
Tue Oct 18 10:19:05 CEST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

On 10/17/2011 03:33 PM, Syam Krishnan wrote:
> Hi..
> 
> I would like my Qt application display a 'build version'  that
> changes every time it's compiled. i.e. the string should identify a
> unique build of the executable. I want to display this version
> string when the user invokes the 'About' box for the application.
> My idea of such a build version is a string that represents the
> time at which the build was done. For example, something like:
> "201110171900" (ignoring seconds).
> 
> In another project with hand-made Makefile, I'm doing this with a
> make rule for auto-generating a header file that has such a
> pre-processor macro.
> 
> Can anything similar be done with QMake? I tried the manuals, but 
> couldn't find anything that would help me here. Any number/string
> that uniquely identifies the build will be sufficient.

You can also use something like:

VERSION = $$system(date "+%Y%m%d%H%M")
DEFINES += VERSION=\\\"\"$$VERSION\"\\\"
message ("Version:" $$VERSION)

You only have to check the format of the "date" function on the
platforms you support.

Br,

Robert


> 
> Regards,
> 
> Syam
> 
> 
> _______________________________________________ Qt-interest mailing
> list Qt-interest at qt.nokia.com 
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOnTZ5AAoJEFxyEaJhvswtdH8H/0ZmhAekvLnu500N1AHEjsRu
jlAv71qEMnSbNH/0/ALL1qpRASdkbqzG4pGMRhpd5UtPHEaMR2NCGe5w9VXmLLOS
WTLyFOcsqhgmTlNuB6E+zidKRIXRGytrLASUNY7zObAQ0Ne+GbBLJdBMDvo096+M
qQ+gkTuXan6B42xoFr648/npo3+8CX2RJNjUp3cnxGXRpemHYfyLWNLqX+ECwZEr
4EvDgNpx1KvgAibfe1Wwv1xmZH/gTcAWKK6v5Fd4V163ZOszH8DGY2lcMkUop/Ta
vOobd1/EVPW9eQcO8XN8T8WbulaAT5Xjur7YsYuAJKnx4AgVXAdUdrXH6+4PLtY=
=z6Mi
-----END PGP SIGNATURE-----



More information about the Qt-interest-old mailing list