Boost logo

Boost-Build :

Subject: [Boost-build] How best to combine "using xxx", toolset invocation, and conditions?
From: Jess Peterson (jess_at_[hidden])
Date: 2013-12-23 05:59:50


Sometimes, in jamfiles it is necessary to specify flags based on toolset.
 It would be nice if those toolset conditions matched the various "using"
initializations. That is, it would be nice if I could say something like
"using gcc : w32cross : /dir/xxx" and on the command line "b2
toolset=gcc-w32cross" and in a condition "<toolset>gcc-w32cross:<cflags>-w"
but it does not seem to work that way. In particular the gcc.jam file runs
gcc a couple of times to get the machine and version and then creates a
condition like gcc-4.8.1-mingw sometimes using the undocumented <flavor>.
 Unless the generated condition is used in b2 invocation and in conditional
build lines I have problems getting it to do the right thing. For example,
if I do not specify a version in the "using" statement, then it will insert
one into the condition, which might mean that the various conditions in
Jamfiles need to change to make sure the toolset is matched. If I specify
a version number, gcc.jam will check the compiler version and warn if the
version does not match. If I specify a tag for the version, gcc.jam will
generate a toolset-condition such as "gcc-mingw-mingw" for "using gcc :
mingw : /xxx/g++" which must be specified rather than "gcc-mingw" or it
combines with the default and tries to compile with two invocations in a
row ("g++" "/xxx/g++" ...). All this has led me to some questions:

1) Is this the way it is supposed to work or am I missing something
fundamental?

2) How does the compiler that is actually used get picked out of the
various ones defined in "using" statements?

3) I would think that the best way for it to work would be to say "using
gcc : mytag : ..." and then say "b2 toolset=gcc-mytag" which some examples
seem to indicate should work. If I want it to work this way, should I
change gcc.jam so that the condition it generates is "<toolset>gcc-mytag?



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