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.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to