Boost logo

Boost-Build :

Subject: Re: [Boost-build] passing INSTALL_ROOT into bjam
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-09-10 11:30:55


AMDG

Paul McMahon wrote:
> If I have an install rule like this in my Jamfile:
>
> install dist: /common/foobar//foobar :
> <location>$(INSTALL_ROOT)/usr/local/lib ;
>
> (and a default value for INSTALL_ROOT is defined in my Jamroot),
>
> how do I overide the value of INSTALL_ROOT on the command line?
>
> I tried -s option for bjam but didn't seem to have the desired effect.
>
> I'm calling bjam from a higher level build script that needs to set
> INSTALL_ROOT.
>

This doesn't work because -s sets INSTALL_ROOT in the
global module, which is, therefore, not visible in the context
of the Jamfile.

So... In Jamroot, you can do this (untested):

import path ;
import modules ;

# look up INSTALL_ROOT in the global module.
install-root = [ modules.peek : INSTALL_ROOT ] ;
if $(install-root)
{
    # Make sure that it is bound relative to the current working directory
    # rather than relative to the location of Jamroot.
    install-root = [ path.root [ path.make $(install-root) ] [ path.pwd
] ] ;
}
else
{
    # The default value
    install-root = default/install/root ;
}

# make INSTALL_ROOT visible in all subprojects
path-constant INSTALL_ROOT : $(install-root) ;

In Christ,
Steven Watanabe


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