Boost logo

Boost :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2005-10-12 11:07:20


troy d. straszheim wrote:
> 2) If I can get 1), above, this one is moot. I want to factor out
> some convenience functions into a file test_tools.cpp and have
> this compiled only once, and have test_tools.o added to each test
> executable's link. I've tried adding test_tools.cpp after
> $(sources) in rule run-template in lib/serialization/test/Jamfile
> like this:
>
> rule run-template ( test-name : sources * : requirements * ) {
> return [
> run
> <lib>../../test/build/boost_unit_test_framework
> <lib>../../filesystem/build/boost_filesystem
> $(sources) test_tools.cpp
> : # command
> : #
> : # requirements
> std::locale-support
> toolset::require-boost-spirit-support
> <borland*><*><cxxflags>"-w-8080 -w-8071 -w-8057 -w-8062 -w-8008 -w-0018 -w-8066"
> $(requirements)
> : # test name
> $(test-name)
> : # default-build
> debug
> ] ;
> }
>
> but this of course just recompiles test_tools.cpp for each module.
> Dunno.

You'd need to shove the file into a library and add the <lib>yyy to the
sources. Ex.:

lib test_tools : test_tools.cpp : (needed requirements) : <suppress>true ;

rule run-template ( test-name : sources * : requirements * ) {

   return [

   run

   <lib>../../test/build/boost_unit_test_framework

   <lib>../../filesystem/build/boost_filesystem

   <lib>test_tools
   $(sources) test_tools.cpp

   : # command

   : #

   : # requirements

   std::locale-support

   toolset::require-boost-spirit-support

   <borland*><*><cxxflags>"-w-8080 -w-8071 -w-8057 -w-8062 -w-8008
-w-0018 -w-8066"
   $(requirements)

   : # test name

   $(test-name)

   : # default-build

   debug

   ] ;

}

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk