[SOLVED] qmake. How to get SVN revision number?
-
Could you please advise how to get SVN revision number via qmake?
I need get SVN revision number and set it to the source code file after that build project.
It's something like this :
@
rem batch filerem getting of the SVN revision number
set SVN_revision = ....rem set it to the source file
rem ...qmake myProject.pro release
nmake release
@ -
Hi,
"This":http://stackoverflow.com/questions/15837185/how-to-pass-a-cmd-command-output-to-a-define-macro-in-qmake might be of interest
Hope it helps
-
Thank you for your help! It helped me.
In the result:
We can use "svnversion -n", but there is some important point is that received result can be like a mix of "work copy revision number" and "head revision number" and it can has some symbol's flags (M or S or P, or all symbols together). "Here":http://svnbook.red-bean.com/en/1.7/svn.ref.svnversion.re.html is some detailed description.If you want to use only SVN revision number of "checked out work copy" you have to parse the result.
Under Mac or other Unix we can use "svn info" and "grep". Or under all platforms we can use "svnversion -n" and parse result in the pro file.It can can something like that:
@
#all platforms:
SVNN = $$system("svnversion -n")
SVNN = $$replace(SVNN,"M","")
SVNN = $$replace(SVNN,"S","")
SVNN = $$replace(SVNN,"P","")
SVNN = $$section(SVNN, :, 0, 0)#Unix, Mac
SVNN = $$system("svn info | grep "Revision" | awk '{print $2}'")
@