|
Boost-Build : |
Subject: Re: [Boost-build] Automatic version number or build-id
From: Paulo Márcio Figueiredo Alves (pauloalves1986_at_[hidden])
Date: 2015-09-21 08:13:42
You remove *always BuildTime2.cpp ;* and change
make BuildTime2.cpp : : @buildtimecpp ;
to
make BuildTime2.cpp : : @buildtimecpp : <dependency>$(myfiles) ;
example:
make BuildTime2.cpp : : @buildtimecpp : <dependency>main.cpp
<dependency>second.cpp ;
actions buildtimecpp
{
echo const char* g_BuildTime = "$(time)"; >"$(<)"
}
exe MyExe : main.cpp second.cpp BuildTime2.cpp ;
On Sat, Sep 19, 2015 at 10:17 AM Niklas Angare <li51ckf02_at_[hidden]>
wrote:
> Hi,
>
> I'm trying to get Boost.Build to generate a source file at build time
> containing an automatically generated version number or build-id. I have a
> solution that sort of works. However it causes my exe to be rebuilt every
> time I invoke b2. I would like the source file to be generated only when
> the
> exe is built. And of course it needs to be generated every time the exe is
> built. How do I accomplish that?
>
> Are there examples of this having been done before? I would assume so but I
> haven't been able to find any.
>
> Here's what I have so far:
>
> explicit BuildTime2.cpp ;
>
> always BuildTime2.cpp ;
>
> time = [ SHELL "sh BuildTime.sh" ] ;
>
> make BuildTime2.cpp : : @buildtimecpp ;
> actions buildtimecpp
> {
> echo const char* g_BuildTime = "$(time)"; >"$(<)"
> }
>
> exe MyExe :
> BuildTime2.cpp
> ...
>
> Regards,
>
> Niklas Angare
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost-build
>
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