[cmake-developers] added get_git_revision and get_git_branch commands as follow-up to cmake at cmake.org

Ben Boeckel ben.boeckel at kitware.com
Fri Sep 25 12:14:30 EDT 2015


On Fri, Sep 25, 2015 at 17:32:24 +0200, Daniel Wirtz wrote:
> Hello all,
> here's my proposal for the git convenience functions, see 
> http://public.kitware.com/pipermail/cmake/2015-September/061516.html
> 
> i've also created a pull request 
> https://github.com/Kitware/CMake/pull/185 (before i read 
> CONTRIBUTING.rst, sorry)

Thanks!

One thing that I think should be done is to allow for a format to be
specified. Some will want the long hash, short hash, describe output,
commit date, etc.

However, I think there is a larger issue: this is setting people up for
failure if they want the hash of the source tree in their build. These
commands really should be run at *build* time because cmake will not
necessarily rerun if the git commit changes which makes it easy for the
git data to be silently wrong.

See this[1] code for what should be done for full "put the git hash in
the build" support including tarballs without a .git directory. The
sprokit_configure_file basically adds a command which runs a script to
configure the file at build time (the list of variables are passed
explicitly).

> additionally, can someone hint me as to how to build the html-help 
> locally? i want to be able to check the generated help output .. some 
> quick search did not get me any how-to's.

You need to have sphinx enabled and then set SPHINX_HTML=ON.

--Ben

[1]https://github.com/Kitware/sprokit/blob/master/src/sprokit/CMakeLists.txt


More information about the cmake-developers mailing list