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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Blezek, Daniel J.
Sent: Wednesday, November 05, 2008 3:00 PM
To: [email protected]
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 [EMAIL PROTECTED] 

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

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to