[CMake] Last minute build-date file.

william.crocker at analog.com william.crocker at analog.com
Fri Oct 15 14:50:12 EDT 2010


>>
>> If my app requires relinking, then at link time
>> I would like to capture the current date and time and place it
>> in a last-minute source file which is linked with the application.
>> Following is my attempt at this with CMake.
>>
> 
> This is just OTTOMH, but could you have something like this:
> 
> #include <string>
> const std::string link_date( __DATE__ );
> const std::string link_time( __TIME__ );
> 
> in a separate blah.cc file? Then set the "blah" target to one of the
> PHONYs in the Makefile (those are the ones that always recompile
> regardless, right?), and make sure it's a requirement for every link.
>

Dear Fatman:

One of the key points here is "If the app needs relinking...".
The link_date file can not cause the app to be relinked, but
if it IS relinked, you want to use an up-to-date version which
captures the current date and time of the link.

I like the use of __DATE__ and __TIME_ though.
Those will probably be a part of the final, portable solution.

Bill


> Not sure how else you could accomplish this.
> 


More information about the CMake mailing list