From: Rene Rivera (grafik.list_at_[hidden])
Date: 2004-07-23 09:13:37
Robert Ramey wrote:
> Edward Diener wrote:
>>How can the jamfile be modified so that those who have an older compiler,
>>and don't need Spirit 1.6 for XML serialization, can build the
>>serialization library without Spirit 1.6 ? That was my point essentially.
> In order to compile with older compilers the variable SPIRIT_ROOT has to be
> defined and point to the root where spirit is installed.
> So the build jamfile would have to be modified so that that the modules for
> XML are build if and only if:
> a) If the compiler is an older compiler
> b) && SPIRIT_ROOT is defined to something not null
> c) || the compiler is a newer compiler.
> I think the build jamfile could altered to do this. I spent a little time
> at it but didn't immediately see how to do it. But I think it should be
> possible. Its probably trivial for a BJAM guru - so feel free anyone. Also
> it would be nice if it echoed a comment indicating that its skipping the XML
> components for lack of SPIRIT_ROOT.
Although it's now possible to do this, I would *not* recommend this as a
solution. The basic problem with changing the Jamfile to skip the
building is that it will only work if people use the Jamfile. That's
fine for testing, but not for release. Many people out there don't use
BB for building Boost.
The better approach is to #ifdef the code itself to either #error or
#warn based on a compiler check and a check for SPIRIT_ROOT. Also
possible in the case of libraries using Spirit is to wrap code that
requires it so that it compiles to nothing if Spirit is not available.
Using Spirit specific prefix and postfix header for this would be
convenient. For example Spirit could provide pre/postfix headers that do
the check, and Spirit dependent code would do this:
// optional code that requires spirit, not compiled if not available
-- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk