Boost logo

Boost-Build :

Subject: [Boost-build] Enforce unit test when compiling a lib target
From: Marc (marc877_at_[hidden])
Date: 2014-12-19 07:32:27

Hi, I'm trying to compile and run a unittesting project of a lib whenever
that lib is compiled as a dependency of another project. For example:

- The unit testing project of 'mylib': ./mylib/tests/Jamfile

project /mylib/tests : requirements <library>../lib//mylib ;
unit-test mylib_tests : [ glob-tree *.cc ] /unittest//boost_main ;

- The lib project of 'mylib': ./mylib/lib/Jamfile

project /mylib/lib : usage-requirements <include>. ;
lib mylib : [ glob-tree *.cc ] : <link>static ;

Now I have a large number of other projects that use '/mylib/lib', e.g,

project /some/other/project : requirements <library>/mylib/lib//mylib ;

Whenever mylib is compiled by this other project, I want it to run
mylib_tests before it returns a successful build of mylib itself. This
shall be orchestrated by the mylib build and not the /some/other/project
build. I tried adding:

use-project : ../tests//mylib_tests

to ./mylib/tests/Jamfile, however, this is only called when compiling the
mylib project directly, but not when the third project is compiled.

Somehow this needs to be added to a dependency of /mylib/lib//mylib, but
it's not really a dependency because the unit-test depends on the lib, it's
rather a post-processing event for mylib/lib//mylib.

I know I could add the tests to the third project Jamfile directly, but
then I would have to do it for every project that uses mylib.

Is there a way to specify a post-command that forces to compile/run the
test project whenever the mylib target is being built?


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