Boost logo

Boost-Build :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2005-12-28 18:31:02


Claudio Pacciarini wrote:
>My latest problem:
>
>I have these two directories:
>
> test
> test\simple
>
>But being inside directory 'test', when I enter bjam, I get this:
>
>error: Unable to find file or target named
>error: 'boost_unit_test'
>error: referred from project at
>error: 'simple'
>
>Why is this happening? Shouldn't the lib be inherited from the parent
>Jamfile?

BB does not inherit targets from parent Jamfiles. This prevents name
collisions. Since boost_unit_test resides in the test directory and you want
to refer to it from test/simple, you need to reference it as:

   ..//boost_unit_test

where the ".." means refer to the parent directory just like normal
directory navigation, "//" means refer to this target and the rest is the
target name. Anything before the "//" is treated as navigating a directory,
so you could have:

   ../../test//boost_unit_test

if you really wanted to. In this example, though, it doesn't make any
difference.

>What I'm trying to avoid is having to specify boost's unit test lib on each
>test project (in this case I have only one, 'simple'). How can I do this?

You could try adding something like:

project test : : requirements
      <variant>debug:<library>boost_test-debug.lib
      <variant>release:<library>boost_test-release.lib
   ;

to the test/Jamfile. Note that I am not sure of the exact syntax, so you
would need to refer to the www.boost.org/boost-build2 documentation. This
works because BB inherits all project requirements from parent Jamfiles upto
and including the first directory containing a project-root.jam file.

>Also: do I have to specify in the Jamfile inside directory 'test' each of
>the test projects I want to build? Isn't it possible to build all sub
>projects automatically?

BB will only build any project dependencies. If you want to automatically
build sample from the test directory, you will need to add:

   build-project sample ;

which will force BB to evaluate all targets in sample/Jamfile and build any
that are out-of-date.

HTH,
- Reece


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