Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt auto software version?

Tags:

qt

Does Qt maintain any sort of versioning information about your program like .NET does? Like the build number? Or does it provide an easy way to access the SVN revision?

like image 910
mpen Avatar asked Sep 03 '09 20:09

mpen


1 Answers

No.

But if you're using qmake then you can set compiler flags in the build system based on the results of arbitrary commands, which might be usable to do what you want.

For example, if you were using git, you could do something like this in your .pro file:

REVISION = $$system(git rev-parse HEAD)
DEFINES += APP_REVISION=$$REVISION

That would give you an APP_REVISION macro when compiling your program, which you could use like this:

// stringize macro
#define _STR(X) #X
#define STR(X) _STR(X)
QTextStream(cout) << "MyApp revision " STR(APP_REVISION) << endl;
like image 113
rohanpm Avatar answered Oct 07 '22 02:10

rohanpm