[CMake] CMake generated build number?

Alexander Neundorf a.neundorf-work at gmx.net
Wed Nov 5 16:54:54 EST 2008


On Wednesday 05 November 2008, J.S.Wijnhout at lumc.nl wrote:
> 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.

You can use add_custom_command(POST_BUILD ) to touch that file so it will 
always be recompiled the next time.

Alex


More information about the CMake mailing list