Boost logo

Boost-Build :

From: Motonari ito (motonari_at_[hidden])
Date: 2004-09-28 18:29:51


I'm playing around boost jam v2, and have a question.

In the following directory structure,

| |
| +- foo.cpp, Jamfile
+-Jamfile, boost-build.jam, project-root.jam

by typing "bjam" at [foo] directory, I would like to build "foo.exe"
out of "foo.cpp", and install it into [dist] directory. The [dist]
directory is always located at the project root.

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.

Then my current solution is:

# TOP/foo/Jamfile
import "project-roots" ;
import "path" ;

exe foo : foo.cpp ;

local location = [ project-roots.find-project-root . ] ;
location = [ path.parent [ path.make $(location) ] ] ;
location = [ path.join $(location) "dist" ] ;

stage dist : foo : <location>$(location) ;

It's a little complicated for such a simple task, isn't it?
If you have better solutions, I would like to know.

Thank you.

Motonari Ito (motonari_at_[hidden])

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