Boost logo

Boost-Build :

Subject: Re: [Boost-build] Setting environment variables
From: Vladimir Prus (ghost_at_[hidden])
Date: 2010-11-06 11:41:38


On Thursday, November 04, 2010 23:28:57 Matthew Chambers wrote:
> On 11/4/2010 11:49 AM, Josh Stern wrote:
> > On 11/4/2010 11:30 AM, Matthew Chambers wrote:
> >> On 11/2/2010 10:08 AM, Josh Stern wrote:
> >>> So far as I can gather from the documentation, there is no way to set
> >>> OS environment variables from within boost build. Is that correct?
> >>
> >> Have you tried module.poke and/or the builtin SHELL rule?
> >
> > I have not. Nothing in the manual would lead me to expect that the
> > builtin SHELL rule would help me set environment variables for the
> > current bjam process. Can it? Of course one can write their own shell
> > scripts that then call other tools and call those as the underlying tool
> > - this is what Microsoft already provides for its compilers, but I'm
> > asking about the ability to set variables from within a jam script as a
> > function of other build options. I'm not familiar with module.poke.
> > Where can I learn more about that? (search for poke in the user manual
> > comes up empty).
>
> Honestly I don't know for sure whether either approach will take effect in
> the toolset's execution environment, but it's easy to try.
>
> SHELL "set FOO=bar" ;
> or
> module.poke FOO : bar ; # see module.jam

I am relatively sure that the following will set a variable only for the
command pipeline being executed (and there's nothing after
'set' in that pipeline), while the second will set a global jam variable,
but not an environment variable.

There's no mechanism for setting env variable globally, it has to
be done in each action, if necessary.

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build: http://boost.org/boost-build2

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