Boost logo

Boost-Build :

Subject: Re: [Boost-build] b2 option parsing
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2016-10-30 21:21:41


AMDG

On 10/30/2016 06:56 PM, Stefan Seefeld wrote:
> On 30.10.2016 09:18, aaron_at_[hidden] wrote:
>>> 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
>> <https://github.com/boostorg/build/blob/develop/src/build_system.py#L510>.
>> 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"
>
> I'm not entirely sure I understand what you are saying there: as far as
> I'm aware, I'm not using the "build_system" module. (See
> https://github.com/stefanseefeld/boost.build/blob/python/src/kernel/bootstrap.py).
> So where are the command-line options parsed before they end up in the
> ARGV variable I can fetch from the 'bjam' module (via
> "bjam.variable('ARGV')") ?

https://github.com/boostorg/build/blob/develop/src/engine/jam.c#L516
This should be overridden by calling UPDATE ;.

> And what should I do for 'bar' "to be
> registered as a feature in order for it
> to be interpreted as a property of <bar>baz" as you say above ?
>

The function that handles this is build_request.from_command_line.
https://github.com/boostorg/build/blob/develop/src/build/build_request.py#L108
This won't work at all without large parts
of Boost.Build however.

> Further, calling `../../src/engine/bin.linuxx86_64/b2` from an example
> directory yields
>
> ...found 3 targets...
>
> is there a way to have 'b2' print out the names of those 3 targets, or
> even introspect them using the "bjam" module (or some other API for that
> matter) ?
>

-d+12

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