Boost logo

Boost-Build :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-29 02:27:42


Hi Motonari,

> The obvious solution is:
>
> #---------------------------------
> # TOP/foo/Jamfile
> exe foo : foo.cpp ;
> stage dist : foo : <location>../dist ;
>
>
> However I don't want to write "../dist" because the directory
> structure would be changed in the future. I want to find the
> project root directory somehow.

I think that the best solution to to move the 'stage' invocation to the
top-level Jamfile. That way, you'll have maximum control and won't have to
write stage targets in every subproject.

In current V2, you can also use the <traverse-dependencies>on feature on the
stage target, to automatically find all targets in a given project.

> Then my current solution is:
>
> #---------------------------------
> # TOP/foo/Jamfile
> import "project-roots" ;
> import "path" ;
>
> exe foo : foo.cpp ;
>
> local location = [ project-roots.find-project-root . ] ;

I think the simplest way is to use

path-constant TOP : . ;

in the top-level project-root.jam. After that, you can use the $(TOP) variable
everywhere in your project.

I've added this question to the FAQ, at
http://boost.org/boost-build2/doc/html/ch06s06.html.

Thanks!

- Volodya

 


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