[Scons-users] Library configuration

Evan Driscoll driscoll at cs.wisc.edu
Tue Jun 19 23:25:39 EDT 2012


What's "best practice" for allowing users to specify the location of a
library?


For instance, suppose I have the following file:

// test.cpp
#include <boost/version.hpp>
#if BOOST_VERSION < 104601
# error "You need a newer boost"
#endif

If I compile this on my RHEL 5 office machine with just 'g++ test.cpp', it does
not work. Instead, I have to pass a different include path. What I'm asking is
how do you get that path into the construction environment (without hard-
coding it, of course; assume that option is out)?


There are so many potential choices; I'm trying to figure out if there's a
standard, typical way:

* Look at os.environment at C{,PP,XX,C}FLAGS and LDFLAGS and ParseFlags them
into your environment

* Look at ARGUMENTS (or a Variables object) for *FLAGS

* Look at ARGUMENTS for an argument like "with-boost-incdir=/blah/include"

* Use {Add,Get}Option to look for an argument like "--with-boost-incdir=..."


For instance, in my experience (I build packages fairly regularly, though I do
admittedly run into the need to do something like this relatively
infrequently) if I am trying to build a project with Autoconf, it seems like
'--with-boost-incdir=...' and '-with-boost-libdir=...' are almost guaranteed
to work, but if I were building an SCons project I don't think I'd know at all
what to expect. This seems like a drawback.

Evan



More information about the Scons-users mailing list