[CMake] CMake generated build number?

J.S.Wijnhout at lumc.nl J.S.Wijnhout at lumc.nl
Wed Nov 5 10:23:33 EST 2008


Hi,

Just a thought: Why don't you use the date and time? The compiler can provide those for you. We use two static functions for this:
const char *GetBuildDate ()
{
  return __DATE__;
}

const char *GetBuildTime ()
{
  return __TIME__;
}

Of course if you don't do a clean build, then the date and time won't get updated. In the past we used a different method, just passing the date and time through the compiler directly:
gcc -D`date +"%Y%m%d %H%M%S"`

Using the subversion revision number is also nice. For that, you could probably using the "exec_program" command that executes "svn info". After that you'll need some regex magic to retrieve the revision number from that.

best,
Jeroen

Leiden University Medical Center


________________________________

From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of Blezek, Daniel J.
Sent: Wednesday, November 05, 2008 3:00 PM
To: cmake at cmake.org
Subject: [CMake] CMake generated build number?



Hi, 

  I'd like to have a monotonically increasing "build number" auto generated by CMake.  This would be for official builds of the software, so we could track algorithm changes / results.  I'd also be happy if CMake could pull the latest SVN revision number.  This would go in a -D during the build.

Any clues how to do this? 

Thanks, 
-dan 

Daniel Blezek, PhD 
Medical Imaging Informatics Innovation Center 

P 127 or (77) 8 8886 
T 507 538 8886 
E blezek.daniel at mayo.edu 

Mayo Clinic 
200 First St. S.W. 
Harwick SL-44 
Rochester, MN 55905 
mayoclinic.org 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081105/1c65a511/attachment.htm>


More information about the CMake mailing list