|
Boost-Build : |
Subject: Re: [Boost-build] How to write a warn-once rule?
From: Juraj Ivanèiæ (juraj.ivancic_at_[hidden])
Date: 2013-02-11 18:49:05
On 11.2.2013. 23:47, Matthew Chambers wrote:
> I'm trying to write a rule like:
>
> rule warn-once ( once-flag ? : message )
> {
> if ! $(once-flag)
> {
> once-flag = true ;
> echo $(message) ;
> }
> }
>
> But it doesn't work because once-flag is passed by value. Is there a way to pass it by reference or
> a different way to approach this while still getting a simple interface?
I'd try something like this
rule warn-once ( warning-var )
{
if ! $(.issued.$(warning-var))
{
ECHO $($(warning-var)) ;
}
else
{
ECHO Already issued! ;
}
.issued.$(warning-var) = true ;
}
.warning = WARNING TEXT ;
warn-once .warning ;
warn-once .warning ;
This approach has its problems, but might do the trick for you.
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