Boost logo

Boost-Build :

Subject: [Boost-build] Finding the Boost root directory in sandbox libraries and within a Boost tree
From: Edward Diener (eldiener_at_[hidden])
Date: 2010-11-28 21:06:46


In my sandbox library I want to have a way that finds the Boost root
directory of an installation for my jamfiles, both when the end-user
uses my jamfiles from within the sandbox directory and also when the
end-user moves my sandbox library under a Boost tree.

I have been given two methods to do this, one by John Maddock and one by
Daniel James, for a sandbox library, but I do not see how either method
will work properly after the end-user moves my library under a Boost tree.

In the method suggested by John Maddock, mentioned in the sandbox
readme.txt file, the lines:

import modules ;
local boost-path = [ modules.peek : BOOST ] ;

are put in a jamfile and boost-path points to the Boost root. But this
requires the end-use to either set the BOOST environment variable to the
boost root directory or specify

--boost=path

on the command line where path is the root of a Boost tree. It also
appears to require the boost-build.jam in the sandbox directory. I can
not see how this method is supposed to work once an end-user moves my
sandbox library under a Boost tree since clearly the boost-build.jam is
different. I don't mind instructing the end-user that they need to add
--boost=path to their bjam invocations for my sandbox library wherever
it is placed, since this is much more flexible than setting an
environment variable, but given that boost-build.jam will be different
in a Boost tree, I can not see how this will work there.

In the method suggested by Daniel James I should use the jam file setup
in the sandbox 'example' library, with its project-root.jam and its
various jamfiles at the project root level and at the test and doc
levels. But this requires the BOOST_ROOT environment variable to be set,
which is something I doubt an end-user is usually going to want to do
when they move the library under a Boost root since it hardcodes a Boost
root location. If the end-user then wants to use a sandbox library for a
different Boost tree, the BOOST_ROOT environment would then need to be
reset. Otherwise this method seems fine so it seems the best choice of
the two.

Is there any easier way that a sandbox directory can find the Boost root
without either of these machinations, so that when the end-user tries to
use the jamfiles of a sandbox library from within its sandbox directory,
or moves it under a Boost tree, it sets a bjam local variable to the
Boost tree root correctly in either case ? Perhaps I am asking for too
much for a sandbox library. Currently for my sandbox library I am asking
the end-user to move the library under a Boost tree in order to use it
and hardcoding a local variable to the Boost root of that tree based on
that, but I would rather do otherwise especially as it should be
possible to try my sandbox library without having to move it under a
Boost tree. I guess I am looking for a combination of Daniel James'
method and the ease of use in John Maddock's method where a command-line
option points to the root of the Boost tree since I feel that requiring
the end-user to set/change environment variables seems onerous.


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