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

Bill Crocker william.crocker at analog.com
Mon Oct 17 15:38:02 CEST 2011


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.
>

I use the QMAKE_PRE_LINK and QMAKE_POST_LINK options to do this.

> Regards,
> 
> Syam
> 





More information about the Qt-interest-old mailing list