[Insight-developers] incorporating commit info
Brad King
brad.king at kitware.com
Thu Apr 26 08:13:42 EDT 2012
On 4/25/2012 3:15 PM, M Stauffer -V- wrote:
> Is CMakeVersionSource.cmake run from cmake or as a cmake script from
> makefiles (I'm assuming the latter is possible)?
It's run during CMake processing, not during the build.
> 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?
It's probably possible but CMake almost always reruns so we haven't
noticed problems. That may be different for ITK though.
> If such a cmake script
> could be run from a makefile then the current commit and index status
> would always be accurate.
The script should run at build time in a custom target that always runs
and on which other targets (that use the generated header) depend using
add_dependencies. The generated header should be updated only when
changed (copy-if-different).
> 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.
Yes, it goes into a configured header file.
-Brad
More information about the Insight-developers
mailing list