Boost logo

Boost-Build :

Subject: [Boost-build] mixing of default-build settings seems broken
From: Moritz Hassert (mhassert_at_[hidden])
Date: 2010-05-03 11:41:58

Hi boost-build gurus,

I am using boost build for a custom project and ran into a problem using the
"default-build" attribute of the project rule:

(Ubuntu 9.10, gcc 4.4, tested both with older version of boost build from
distro and nightly builds)

I need to define project-wide values for several features while still allowing
to override them on the command line. For example, I set the <address-model>
according to the current host but override it when doing a cross build.
This works fine using the "default-build" attribute in the project rule in my
Jamroot. It's propagated to all targets in all sub-projects.

I also need to specify default values for other features on certain targets
only. For example, the default for <link> is 'shared' and that's fine. But some
executables should be built 'static' by default, allowing overriding on the
command line. So I set a default feature value in the default-build section of
the exe rule of such a target. (See minimal example below)

When doing a 'bjam testexe --debug-building -d+2' one can see that
<link>static is inherited by testlib, because testexe needs a static lib and
<instruction-set>i486 is also inherited by testlib, because testlib belongs to
project test-project. But testexe does not inherit <instruction-set>i486
although its in the same project. So test.cpp is compiled with '-march=i486'
while main.cpp is compiled without.

When you remove the '<link>static' from testexe, <instruction-set>i486 is
inherited by the exe target as expected.

To me, this seems boken. Target-specific defaults should be appended to
project-wide ones (possibly overriding previously defined ones) instead of
replacing them.

Can you confirm this is a bug or am I doing something wrong here?

# Minimal Jamroot Example:

project test-project
  : default-build
    <instruction-set>i486 ;

lib testlib : test.cpp ;

exe testexe : main.cpp testlib : : <link>static ;

Thanks and kind regards,
Moritz Hassert

Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at