|
Boost-Build : |
From: Vladimir Prus (ghost_at_[hidden])
Date: 2004-09-07 05:43:01
Toon Knapen wrote:
> In the mipspro toolset for bjamv2 (which I'm working on) I need to add
> the path $(BOOST_ROOT)/boost/compatibility/cpp_c_headers to the
> C++FLAGS. But for that I need to know BOOST_ROOT. I was hoping a
> variable BOOST_ROOT would be defined that points to this location but I
> tried
>
> local boost_root = [ modules.peek : BOOST_ROOT ] ;
> ECHO $(boost_root) ;
>
>
> but it turns out to be empty (although another toolset uses the same
> trick). Any ideas about how i can do this ?
Hi Toon,
the first question is why you're trying to do this? Is the toolset just
completely broken without compatibility headers? What if someone tries to use
the toolset without Boost?
Assuming requiring Boost around is OK, you can do the same thing as boostbook
does
1. Take BOOST_ROOT from environment, if it's set there
2. Take BOOST_BUILD_PATH and add "../../.." to try getting boost root path
3. GLOB the resulting paths for boost/compatibility/cpp_c_headers
Here's the relevant code:
local boost-root = [ modules.peek : BOOST_ROOT ] ;
if $(boost-root)
{
boost-root = [ path.make $(boost-root) ] ;
}
local boost-build-root = [
sequence.transform path.make : [ modules.peek : BOOST_BUILD_PATH ]
] ;
local search-dirs = [ path.join $(boost-root) tools boostbook ]
$(boost-build-root)/../../boostbook ;
local boostbook-xsl-dir ;
for local dir in $(search-dirs) {
boostbook-xsl-dir += [ path.glob $(dir) : xsl ] ;
}
(Note that 'path.glob' accepts several paths, so the loop is not really
necessary).
I'd suggest that you also provide a toolset parameter which the user can use
to specify the location of boost root, in case this auto-detection fails.
HTH,
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