[Insight-developers] incorporating commit info

M Stauffer -V- mstauff at verizon.net
Wed Apr 25 15:15:19 EDT 2012


Thanks Brad.

Is CMakeVersionSource.cmake run from cmake or as a cmake script from
makefiles (I'm assuming the latter is possible)? If the former, then am
I right in thinking that if the user has changed branches since running
cmake, then the commit version will be wrong? If such a cmake script
could be run from a makefile then the current commit and index status
would always be accurate.

What do you then do with the CMake_VERSION_SOURCE variable? I'm thinking
I'd write what I'm looking to produce to a header file that's included
itkVersion.h.

-M

>-----Original Message-----
>From: Brad King [mailto:brad.king at kitware.com] 
>Sent: Wednesday, April 25, 2012 2:49 PM
>To: M Stauffer -V-
>Cc: insight-developers at itk.org
>Subject: Re: [Insight-developers] incorporating commit info
>
>On Wed, Apr 25, 2012 at 2:16 PM, M Stauffer -V- 
><mstauff at verizon.net> wrote:
>> During compilation, I'd like to be able to incorporate the 
>commit hash
>> and at least a flag as to whether there are any local 
>modifications. The
>> goal is to have this info in the itk binaries for reliably 
>referencing
>> what version of the toolkit was used for a particularly build.
>>
>> I hear this has been discussed before. I'm willing to give 
>it a go. If
>> anyone knows the outline of how to do this that'll really 
>help. I think
>> there are git hooks for getting commit info into a header file, but I
>> haven't looked recently. Also, we'll want to add something 
>similar for
>> our ANTS toolkit, which currently is still using svn.
>
>FYI, we do this in CMake's own build:
>
> 
>http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/CMakeVersio
nSource.cmake;hb=v2.8.8
>
>though the implementation pre-dates FindGit.cmake so it does not use
>find_package(Git) as a new implementation should.
>
>It does require a Git command line tool to be found during CMake
>configuration of the project though.  To do that on Windows one should
>use find_package(Git) and require CMake >= 2.8.2 to reliably find
>msysGit.
>
>-Brad



More information about the Insight-developers mailing list