Boost logo

Boost-Build :

From: Matthew Herrmann (matthew.herrmann_at_[hidden])
Date: 2007-11-12 17:42:07

> Is there any way to depend on a target without all of its properties
> > leaking into the dependent target?
> IIRC you can use the, currently undocumented, <implicit-dependency> feature.

Thanks for the suggestion, but touching the unit test cpp doesn't cause
the test to rebuild when I just build the "final" target. Even running
bjam -a doesn't cause it to the link the unit test. I also even tried
putting the implicit-dependency onto the final target, which is
problematic because the library client shouldn't know what unit tests to
run, but unfortunately that doesn't trigger a link either.

Exact code below. I'm running Boost Build V2 (Milestone 12) and
Boost.Jam 3.1.14.

Thanks for your help,

# To create needed cpp files for test, run:
# touch first.cpp final.cpp first_test.cpp

project dependency ;

using gcc : g++ ;

# test library definition
lib first : first.cpp ;
alias second : : : : <include>justforunittest ;
exe first_test : second first first_test.cpp ;
alias tested_first : first : : : <implicit-dependency>first_test ;

# client code that only wants to use tested library
exe final : tested_first final.cpp ;


Command line:

$ touch first_test.cpp
$ bjam final
$ bjam -a final
...found 12 targets...
...updating 4 targets...
gcc.compile.c++ bin/gcc-g++/debug/final.o
gcc.compile.c++ bin/gcc-g++/debug/first.o bin/gcc-g++/debug/ bin/gcc-g++/debug/final
...updated 4 targets...

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