Boost logo

Boost-Build :

Subject: Re: [Boost-build] passing flags to Jamroot
From: Matthew Chambers (matt.chambers42_at_[hidden])
Date: 2011-05-26 16:17:59


On 5/26/2011 2:35 PM, Athanasios Dousis wrote:
> Hello all,
>
> In my Jamroot file, I'd like to use a conditional statement:
>
> if $(flag) = 1 {
> echo "do something"
> } else {
> echo "do something else"
> }
>
> How do I pass in "flag" from the command line, i.e., when I call bjam?
>
> Or alternatively, is there a way to search the environment variable $PATH for a particular compiler (e.g., nvcc) and specify 'build-project' and 'install' conditionally on the existence of the target compiler?
>
> Thanks,
> Nasos Dousis

Any argument starting with double dashes is available in all Jamfiles (unless it has been explicitly
removed).

import modules ;
if --foo in [ modules.peek : ARGV ]
{
# do stuff
}

Negated:
if ! --foo in [ modules.peek : ARGV ]

-Matt


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