Hi Folks, <br><br>This updated version of FindGit supports both git and git-svn. See <a href="http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/CMake/FindGit.cmake?revision=16492&view=markup">http://viewvc.slicer.org/viewvc.cgi/Slicer4/trunk/CMake/FindGit.cmake?revision=16492&view=markup</a><br>
<br>Hth<br>Jc<br><br><div class="gmail_quote">2011/6/5 Nicolas Desprès <span dir="ltr"><<a href="mailto:nicolas.despres@gmail.com">nicolas.despres@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
That's a great idea. I'd like to contribute some function too. I<br>
have rewritten a couple of them while working on project versioned by<br>
Git.<br>
<br>
Cheers,<br>
<br>
-Nico<br>
<div><div></div><div class="h5"><br>
On Sun, Jun 5, 2011 at 11:02 AM, Quintus <<a href="mailto:sutniuq@gmx.net">sutniuq@gmx.net</a>> wrote:<br>
> -----BEGIN PGP SIGNED MESSAGE-----<br>
> Hash: SHA1<br>
><br>
> Hi there,<br>
><br>
> I'm working on a git-versioned project that I'd like to display it's<br>
> version number for development versions like this:<br>
><br>
> 1.2.3-dev (commit abc1234 on devel, 12/4/10)<br>
><br>
> CMake's FindGit module seems to be quite limited as it just gives me the<br>
> path to git's executable file, leaving it on me to invoke the necessary<br>
> EXECUTE_PROCESS() commands to find the current git branch and commit.<br>
><br>
> After some googling, I found this project which added a function<br>
> GIT_TREE_INFO() that provides information on the current commit:<br>
> <a href="http://trac.evemu.org/browser/trunk/cmake/FindGit.cmake?rev=872" target="_blank">http://trac.evemu.org/browser/trunk/cmake/FindGit.cmake?rev=872</a><br>
><br>
> Inspired by this, I wrote another function to get the current branch:<br>
><br>
> FUNCTION(GIT_BRANCH_INFO DIR PREFIX)<br>
> EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" branch --no-color<br>
> WORKING_DIRECTORY "${DIR}"<br>
> RESULT_VARIABLE GIT_RESULT<br>
> OUTPUT_VARIABLE GIT_FULL_BRANCH<br>
> ERROR_VARIABLE GIT_ERROR<br>
> OUTPUT_STRIP_TRAILING_WHITESPACE)<br>
><br>
> IF(NOT ${GIT_RESULT} EQUAL 0)<br>
> MESSAGE(SEND_ERROR "Command '${GIT_EXECUTABLE} branch --no-color'<br>
> failed with following output:\n${GIT_ERROR}")<br>
> ENDIF(NOT ${GIT_RESULT} EQUAL 0)<br>
><br>
> STRING(REGEX MATCH "^\\* *([^ ]*)$"<br>
> GIT_ACTIVE_BRANCH<br>
> "${GIT_FULL_BRANCH}")<br>
><br>
> SET("${PREFIX}_BRANCH" "${CMAKE_MATCH_1}" PARENT_SCOPE)<br>
> ENDFUNCTION(GIT_BRANCH_INFO)<br>
><br>
> Any chance to get this and the function from the evemu project into<br>
> official CMake's FindGit.cmake? I'm not sure about their license, but<br>
> the sourcecode seems to be licensed under LGPL -- if that's too<br>
> restrictive I can write another function providing the same functionality.<br>
><br>
> Marvin<br>
> -----BEGIN PGP SIGNATURE-----<br>
> Version: GnuPG v1.4.11 (GNU/Linux)<br>
> Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org/" target="_blank">http://enigmail.mozdev.org/</a><br>
><br>
> iQEcBAEBAgAGBQJN60X/AAoJELh1XLHFkqhaHpsIAKiJOL1CBXE004WvthoOmJdO<br>
> iCJFRus8RmGgRaNsQUlBBPiMuXJ0iFRBLK/zsKX4ubk6MXALxy4p4kp1a+bToE8k<br>
> l/vEmgrxheva6Bx0Qao1hc/7tYDZXcNvG7ZRDEabSuWSWgsQQqEbqIKQ0sK5L1pw<br>
> uBmXaj/IrJY2u5MO8liq0c/yUF/R39cLa7Hn9MSpf1eXy9QwBsX+HkedrbW0O4Rk<br>
> pzFTX9hAre9iIfawghLVxV66hitN0letGG4nmRnROmPOjwjSYgxkhAoF+RVqRBoT<br>
> anVCFjwOrPUfLXERRN9ELFDJjo7NTnOWQ3VFyr8rnY9TaAqnw+2mMftUhUexSFU=<br>
> =n2I9<br>
> -----END PGP SIGNATURE-----<br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
><br>
<br>
<br>
<br>
</div></div>--<br>
<font color="#888888">Nicolas Desprès<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.cmake.org/mailman/listinfo/cmake" target="_blank">http://www.cmake.org/mailman/listinfo/cmake</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>+1 919 869 8849<br><br>