Boost logo

Boost-Build :

Subject: Re: [Boost-build] How to peek into the global module? / Name of the global module?
From: Deniz Bahadir (D.Bahadir_at_[hidden])
Date: 2010-02-19 04:13:16


2010/2/18 Vladimir Prus <ghost_at_[hidden]>:
>> Or is there a more elegant way?
>
> It probably depends on what your anotherModule actually is. Could you give
> some more details?
>

My "anotherModule" is actually the "feature" module.
I am changing into the feature module, to adjust the settings of the
three default build variants (debug, release, profile).
(See your answer to my question in November 2009:
http://lists.boost.org/boost-build/2009/11/22692.php)

Example:

# A helper-module, which stores important variables.
module Helper-Module
{
        local Jamroot-Module-Name = "" ;
}
# Store the Jamroot module name $( __name__) in Helper-Module.
local dummy = [ modules.poke Helper-Module : Jamroot-Module-Name :
$(__name__) ] ;

# Change settings of default build-variant "release".
module feature
{
        # Get name of Jamroot module.
        local Jamroot-Module-Name = [ modules.peek Helper-Module :
Jamroot-Module-Name ] ;
        # Get optimization flags variables from Jamroot module.
        local Optimization-Flags = [ modules.peek $(Jamroot-Module-Name) :
Optimization-Flags ] ;
                
        <variant>release.components =
                <optimization>speed
                <inlining>full
                <debug-symbols>on
                <runtime-debugging>off
                <define>NDEBUG
                <define>PROFILE
                <runtime-link>shared
                <link>shared
                <threading>multi
                <profiling>off
                <warnings>all
                $(Optimization-Flags)
                ;
}

Maybe it is possible to change the build-variant by using
"modules.poke" without the need for the Helper-Module? But I did not
try it out.

DENIZ


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