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

Brad King brad.king at kitware.com
Fri Sep 25 11:46:55 EDT 2015


On 09/25/2015 11:32 AM, Daniel Wirtz wrote:
> here's my proposal for the git convenience functions, see 
> http://public.kitware.com/pipermail/cmake/2015-September/061516.html

Thanks for working on this.

> 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.

Configure CMake with -DSPHINX_HTML=ON.  Be sure you have python-sphinx
installed.  Point SPHINX_EXECUTABLE at the `sphinx-build` command if
needed.

> +#    git_get_revision(VARNAME [WORKING_DIRECTORY])
> +#    git_get_branch(VARNAME [WORKING_DIRECTORY])

Please see the cmake-developer(7) manual section on documenting commands:

 http://cmake.org/cmake/help/v3.3/manual/cmake-developer.7.html#cmake-domain

Run

  git grep '\.\. command::' -- Modules

to see some examples.

> +# Added by Daniel Wirtz<daniel.wirtz at simtech.uni-stuttgart.de>

This information is recorded in the commit history and so is not needed
here.  You can add a line to the copyright block if you want.  Just be
sure it passes the ModuleNotices test.

> +function(git_get_revision VARNAME)
[snip]
> +    execute_process(COMMAND ${GIT_EXECUTABLE} rev-list --max-count=1 HEAD

Perhaps:

 git rev-parse --verify -q HEAD

?

> +function(git_get_branch VARNAME)
[snip]
> +    execute_process(COMMAND ${GIT_EXECUTABLE} describe --all

Perhaps:

 git symbolic-ref -q HEAD

?

Thanks,
-Brad



More information about the cmake-developers mailing list