<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jun 8, 2019 at 3:25 PM Steven Truppe <<a href="mailto:workbench@gmx.at">workbench@gmx.at</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi everyone,<br>
<br>
i want to have code lines like:<br>
<br>
#define BUILD_VERSION<br>
<br>
and the BUILD_VERSION should be the name of the actual branch the code<br>
was compiled with, this way i can create a branch for each version and<br>
name it like 0.1 so each version i'm using for release is an own branch.<br>
<br>
I found many examples that shows me the branch name (like git status)<br></blockquote><div>git branch</div><div>Hmm this shows a list of things, have to extract the one with a * on the beginning... cam probably use CMAKE list functions on the output.</div><div><br></div><div><br></div><div>EXECUTE_PROCESS(WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} COMMAND git rev-list --max-count=1 HEAD OUTPUT_VARIABLE CURRENT_REPO_REVISION )<br></div><div><br></div><div>gives me the last hash...</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
but i don't know a way to get only the name of the current branch so i<br>
can for example execute_process to get the revision number into a<br>
variable and then use add_definition(..) to add it as a compile definition.<br>
<br>
<br>
best regards!<br>
<br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div></div>