Boost logo

Boost-Build :

Subject: Re: [Boost-build] How to peek into the global module? / Name of the global module?
From: Vladimir Prus (ghost_at_[hidden])
Date: 2010-02-18 15:17:50


On Thursday 18 February 2010 21:14:28 Deniz Bahadir wrote:

> Thanks,
>
> that really helped.
>
> And you were right, I did not want to access the global module, but
> instead the Jamroot-module.
> Sadly, for accessing the Jamroot-variable $(__name__), I am running
> into the same problem as before.
> However, with a little workaround (as in the following example) it worked:
>
>
> module Helper-Module {
> local Jamroot-Module-Name = "" ;
> }
> # now store $(__name__) in Helper-Module.
> local dummy = [ modules.poke Helper-Module : Jamroot-Module-Name :
> $(__name__) ] ;
>
> myVariable1 = "myVal1" ;
> constant myVariable2 : "myVal2" ;
>
> module anotherModule {
> local Jamroot-Module-Name = [ module.peek Helper-Module :
> Jamroot-Module-Name ] ;
> echo "myVal1 is: " [ modules.peek $(Jamroot-Module-Name) : myVariable1 ] ;
> echo "myVal2 is: " [ modules.peek $(Jamroot-Module-Name) : myVariable2 ] ;
> }
>
>
> Or is there a more elegant way?

It probably depends on what your anotherModule actually is. Could you give
some more details?

Thanks,

--
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