Boost logo

Boost-Build :

From: Kevin Wheatley (hxpro_at_[hidden])
Date: 2006-08-09 18:19:20


Artem Alimarine wrote:
> I wanted something like:
>
> # jam file for myexe
> exe myexe : main.cpp tested_mylib ;
>
> # jam file for the library
> lib mylib : ... ;
> unit-test mylib_test : ... ;
> ??? tested_mylib : mylib : mylib_test ;

here is something that I do, (suggestions for better things greatly
received :-)
In my Jamroot:

# Boost Build's testing rules, etc.
import testing ;

# Pulls in some fake targets in particular the
# /testing//usage-requirements which just allows some headers defining
# my test utilities to be on the include path
use-project /testing : testing ;

rule run-tests ( sources * : extra-sources * : requirements * )
{
     for local s in $(sources)
     {
         local testexe = [ MATCH ^(.+)\..+$ : $(s) ] ;
         unit-test $(testexe) : $(s) $(extra-sources) /boost//test
                /testing//usage-requirements : $(requirements) ;
     }
}

Then in my Jamfiles:

run-tests [ glob tests/*_tests.cpp ]
         : mylib
         :
         ;

lib mylib : [ glob src/*.cpp ] ;

Its not quite right in that the exe could still be built if the tests
fail, but thats what I wanted in this case.

Kevin

-- 
| Kevin Wheatley, Cinesite (Europe) Ltd | Nobody thinks this      |
| Senior Technology                     | My employer for certain |
| And Network Systems Architect         | Not even myself         |

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