Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-04-05 08:36:54


Hi Craig,

> I am trying to replace some GNU Makefiles with
> Boost Build. Due to the way my source tree is (not my design!)
> an individual binary is composed of source files scattered
> in many directories. With GNU make, we use VPATH
> a lot to get around this problem.
.....
> On my system, I took the "hello" example which comes
> with Boost build, and moved the hello.cpp file to a directory:
> "/tmp/foo1"
>
> I then modified the Jamroot file in "hello" example directory to:
>
> SRC1 = hello.cpp ;
> #SEARCH = "/tmp/foo1" ;
> SEARCH on $(SRC1) = "/tmp/foo1" ;
> exe hello : $(SRC1) ;
>
>
> However, bjam complains:
> error: Unable to find file or target named
> error: 'hello.cpp'
> error: referred from project at
> error: '.'
..
> What am I doing wrong?

Well, the code you're using would not even work with Perforce Jam, because the
real names of the targets that jam see are not plain "hello.cpp" but have so
called 'grist', that identifies the directory name.

With Boost.Build things are even more complex. We have a code that explicitly
checks for file existence and produces the above error. So, even with the
right "grist" you'd still get the error. I find it's more clearer than
"cannot find file" message from Perforce Jam.

If you had one directory, you could write:

project : source-location /tmp/foo1 ;
exe hello : hello.cpp ;

For the case of several directories, you need the 'glob' rule:

SRC = hello.cpp hello2.cpp ;
DIRS = /tmp/foo1 /tmp/foo2 ;

exe hello : [ glob $(DIRS)/$(SRC) ] ;

HTH,
Volodya

-- 
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2
 

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