Subject: Re: [Boost-build] Generating random number string in b2
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2016-10-10 11:38:31
On 10/10/2016 09:07 AM, Edward Diener wrote:
> Is there a way to generate a random number string in b2 ?
> I have a rule which may be invoked more than once with the same
> parameters from a jam file. The rule creates build targets based on the
> parameters and I need to give each build target a unique name. Of course
> it would be nice if the end-user invoked the rule with the same
> parameters only once in a jamfile and saved the result in a local
> variable but I cannot force that usage. Therefore I want to generate a
> uniquely named build target even when the parameters to the rule are the
> same. I am using configure.builds with the build target so as long as my
> uniquely named build target matches what is passed to configure.builds I
> am OK.
The usual method is to use a counter.
.target-id = 0 ;
rule get-next-id ( )
.target-id = [ CALC $(.target-id) + 1 ] ;
return $(.target-id) ;
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