Boost logo

Boost-Build :

Subject: Re: [Boost-build] accessing compilation date in source file
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2010-08-23 12:32:02


Avi Bahra wrote:
>I want to log/store or make available the compilation date
>within the C++ source files, but cant find any references to this
>in the docs. Is this possible with bjam ?
>
>Any help appreciated.
>
> Best regards,
>Ta,
> Avi

You can use the __DATE__ predefined preprocessing symbol. To make the source
file containing it to be always recompiled, use the 'always' rule.

// build_date.cpp
const char * const build_date = __DATE__;

// jamfile
obj build_date : build_date.cpp ;
always build_date ;
exe my_exe : main.cpp build_date ;

Best Regards,
Gevorg


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk