<div dir="ltr"><div>For my git info, I am using what feels like a hacky way to avoid having to add pre-build steps on every single project configuration. Might help?</div><div><br></div><div>In my .pro:</div><div><br></div><div>

<pre style="margin:0px"><span style="color:rgb(0,128,0)">#</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Get</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">our</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">build</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">info</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">from</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">git</span></pre>
<pre style="margin:0px"><span style="color:rgb(128,0,128)">OTHER_FILES</span><span style="color:rgb(192,192,192)"> </span>+=<span style="color:rgb(192,192,192)"> </span>"$$<span style="color:rgb(128,0,128)">PWD</span>/gen_header.sh"</pre>
<pre style="margin:0px"><br></pre>
<pre style="margin:0px">!build_pass<span style="color:rgb(192,192,192)"> </span>{</pre>
<pre style="margin:0px"><span style="color:rgb(192,192,192)">    </span>UNUSED_RESULT<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>$$<span style="color:rgb(128,128,0)">system</span>(bash<span style="color:rgb(192,192,192)"> </span>"$$<span style="color:rgb(128,0,128)">PWD</span>/gen_header.sh")</pre>
<pre style="margin:0px">}</pre>
<pre style="margin:0px"><br></pre>And then the contents of gen_header.sh:</div><div><br></div><div>

<pre style="margin:0px"><span style="color:rgb(0,128,0)">#!/bin/bash</span></pre>
<pre style="margin:0px"><br></pre>
<pre style="margin:0px"><span style="color:rgb(128,128,0)">(</span></pre>
<pre style="margin:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,0,128)">echo</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">'//</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">Generated</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">by</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">gen_header.sh</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">-</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">do</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">not</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">edit'</span></pre>
<pre style="margin:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,0,128)">echo</span></pre>
<pre style="margin:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,0,128)">echo</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">'#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">GIT_VERSION_LONG</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"'</span><span style="color:rgb(128,128,0)">`</span>git<span style="color:rgb(192,192,192)"> </span>describe<span style="color:rgb(192,192,192)"> </span>--long<span style="color:rgb(128,128,0)">`</span><span style="color:rgb(0,128,0)">'"'</span></pre>
<pre style="margin:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,0,128)">echo</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">'#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">GIT_VERSION_HASH</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"'</span><span style="color:rgb(128,128,0)">`</span>git<span style="color:rgb(192,192,192)"> </span>log<span style="color:rgb(192,192,192)"> </span>--pretty=format:<span style="color:rgb(0,128,0)">'%h'</span><span style="color:rgb(192,192,192)"> </span>-n<span style="color:rgb(192,192,192)"> </span>1<span style="color:rgb(128,128,0)">`</span><span style="color:rgb(0,128,0)">'"'</span></pre>
<pre style="margin:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,0,128)">echo</span></pre>
<pre style="margin:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,0,128)">echo</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">'#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">GIT_BUILD_DATE_LONG</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"'</span><span style="color:rgb(128,128,0)">`</span>git<span style="color:rgb(192,192,192)"> </span>log<span style="color:rgb(192,192,192)"> </span>-n<span style="color:rgb(192,192,192)"> </span>1<span style="color:rgb(192,192,192)"> </span>--format=%ai<span style="color:rgb(128,128,0)">`</span><span style="color:rgb(0,128,0)">'"'</span></pre>
<pre style="margin:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,0,128)">echo</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,128,0)">'#define</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">GIT_BUILD_DATE_SHORT</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"'</span><span style="color:rgb(128,128,0)">`</span>git<span style="color:rgb(192,192,192)"> </span>log<span style="color:rgb(192,192,192)"> </span>-n<span style="color:rgb(192,192,192)"> </span>1<span style="color:rgb(192,192,192)"> </span>--format=%ad<span style="color:rgb(192,192,192)"> </span>--date=short<span style="color:rgb(128,128,0)">`</span><span style="color:rgb(0,128,0)">'"'</span></pre>
<pre style="margin:0px"><span style="color:rgb(128,128,0)">)</span><span style="color:rgb(192,192,192)"> </span>><span style="color:rgb(192,192,192)"> </span>gitVersion.h</pre>
<pre style="margin:0px"><br></pre>On Windows I have cygwin installed, so bash may be found. Maybe this trades one type of config for another, but I already use cygwin for many things so I have it installed on all my Windows build machines.</div><div><br></div><div>Another limitation is that it executes every build, but I'm willing to deal with that for the convenience.</div><div><br></div><div>(Just saw Orgad's response - that might be cleaner?)<br></div><div><br></div><div><div><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>---<br>Andy Maloney  //  <a href="https://asmaloney.com" target="_blank">https://asmaloney.com</a><br><div>twitter ~ <span dir="ltr"><a href="https://twitter.com/asmaloney" target="_blank">@<span>asmaloney</span></a></span></div><br></div></div></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jul 6, 2018 at 10:48 AM Murphy, Sean <<a href="mailto:smurphy@walbro.com">smurphy@walbro.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> That is something that should be done by the build system IMHO<br>
<br>
Can you expand on this part? By build system, I assume you mean qmake?<br>
If that's what you meant, I'm all for doing it that way as well, how would I <br>
go about adding what I'm looking for into the .pro file?  <br>
<br>
Basically, in our current setup, we're all using qmake as the build system, <br>
so if there's a solution that works via qmake variables, I'm totally fine with <br>
that too, I just haven't found them yet if they exist. If it matters, we're <br>
currently targeting Windows (using mingw compiler) and Mac desktops, <br>
but have plans for Android and iOS down the road, so I'd like to have this <br>
be something that is set up once, and then each developer gets it for free <br>
when they clone the Git repo.<br>
<br>
As it stands right now, each developer has to manually set these up. Hell, <br>
I even have to manually set it up if I clone my repository on my own <br>
machine. I usually have our release branch checked out in one directory, <br>
and then I clone from there into other directories to create feature <br>
branches. So on that cloned repo, I've temporarily lost those build settings <br>
until I manually re-add them to that cloned directory's .pro.user file, <br>
either by manually copying the previous .pro.user file over, or by using <br>
the Projects pane in Qt Creator to add the steps back in.<br>
<br>
I'm also totally open to being told my approach is just completely wrong, <br>
as long as someone has a better approach!<br>
<br>
Thanks,<br>
Sean<br>
<br>
<br>
<br>
This message has been scanned for malware by Forcepoint. <a href="http://www.forcepoint.com" rel="noreferrer" target="_blank">www.forcepoint.com</a><br>
_______________________________________________<br>
Qt-creator mailing list<br>
<a href="mailto:Qt-creator@qt-project.org" target="_blank">Qt-creator@qt-project.org</a><br>
<a href="http://lists.qt-project.org/mailman/listinfo/qt-creator" rel="noreferrer" target="_blank">http://lists.qt-project.org/mailman/listinfo/qt-creator</a><br>
</blockquote></div>