Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-01-12 05:18:16

Hi Zbynek,

> I was trying to extend my project with a single 'configuration Jamfile'
> where the users could set their preferences. I tried using variables in
> it. The problem is that I do not know the scope of the variables.
> I've created user-settings.jam and in project-root.jam I put 'import
> user-settings.jam'. A variable set in user-settings.jam was only visible
> in the root Jamfile and nowhere else. For now I circumvented the problem
> by using 'constant' rule in project-root.jam but I could not use it in
> the user-settings.jam.
> So - what is the scope of a variable set in a file imported into
> project-root.jam?

If you do "import foobar " then variables in foorbar.jam are local to the
module where they are declared -- in this case, to module 'foobar'. If you
"include foobar", then it's just textual inclusion and they are local to the
module which includes foobar.

> How do I make a global variable?

First, you can set variable at global module via

modules.poke : VAR : some-value ;

and later get it's value via

modules.peek : VAR

That's somewhat inconvenient. OTOH, if you change "import user-settings.jam"
to "include user-settings.jam", you'll be able to use 'constant' in


> Zbynek
> Yahoo! Groups Links
> To visit your group on the web, go to:
> To unsubscribe from this group, send an email to:
> jamboost-unsubscribe_at_[hidden]
> Your use of Yahoo! Groups is subject to:


Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at