|
Boost-Build : |
Subject: Re: [Boost-build] How do I call a rule in another Jamfile?
From: Vladimir Prus (ghost_at_[hidden])
Date: 2014-06-05 02:45:26
On 06/04/2014 09:57 PM, John Maddock wrote:
> Title says it all really, I have a rule defined in one Jamfile that I want to be able to call from elsewhere.
>
> I've tried renaming the Jamfile to "rulename.jam" and then doing a :
>
> import some/path/rulename ;
>
> But loading the Jamfile then fails with:
>
> M:/data/boost/boost/libs/config/test\../checks/config.jam:19: in load
> ERROR: rule "explicit" unknown in module "../checks/config".
The modules loaded with 'import' are just normal modules, like in Python.
When Jamfiles are loaded, they have a few functions injected in their namespace, for
convenience, and 'explicit' is one of those rules.
Does it work if you use
project-rules.explicit
instead? That's the module from where these are injected into Jamfiles.
Looking at it, though, I see an inconsistency. Functions that define metatargets, such
as 'exe' are actually injected to global scope, while 'explicit' is only injected
into Jamfile scope. We probably should do the same for both.
- Volodya
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