Boost logo

Boost-Build :

Subject: Re: [Boost-build] b2 option parsing
From: aaron_at_[hidden]
Date: 2016-10-30 09:18:55


> how (where) does b2 parse and interpret command-line options ? I have
> looked at jam.c and option.c, of course, but couldn't find how for
> example "--python" is handled.
 
There are two types of option parsing that occur. Any of the single dash options
like -h, -a, -j, etc. are parsed by the C engine. All of the double dash options
are ignored by the engine so that they can be examined by Jam. Typically,
a jam file will peek at the global ARGV variable to see if any flags are set.
 
The --python flag is handled in bootstrap.jam (yes, even in the Python port, Jam is still called).
Within that file and when the --python flag is passed, it sets up some Jam rules that
Python itself can't create (e.g. setting target variables, creating actions, etc) then loads the
bootstrap.py module and executes its one function.
 
> Also, when I run `.../b2 --python foo
> bar=baz` I get output such as
>
> don't know how to make bar=baz
 
"bar=baz" is not a flag. Have a look at build_system.py. In the main()
it tries to parse each of the non-dashed command line arguments as a property. or a target
In this case, "bar" would have had to be registered as a feature in order for it
to be interpreted as a property of <bar>baz. Since "bar" was not registered, the full
token "bar=baz" is interpreted as the name of a target which is why you get the error
message "Don't know how to make bar=baz"
 
HTH,
Aaron



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