[Scons-users] Handling user supplied CPPPATH with Variables?
Andrew C. Morrow
andrew.c.morrow at gmail.com
Thu Jan 16 13:23:52 EST 2014
How should list-y variables like CPPPATH be handled with Variables? I'd
like users of my SConstruct to be able to say one of:
scons CPPPATH=/my/first/path CPPPATH=/my/second/path
scons CPPPATH=/my/first/path,my/second/path
Where I have declared a CPPPATH variable with AddVariables:
cmdLineVars = Variables(None, ARGUMENTS)
cmdLineVars.AddVariables(
('CPPPATH', 'Preprocessor search path')
)
env = Environment(
variables=cmdLineVars,
)
In the first case, it doesn't work because the multiple CPPPATH values are
lost during conversion to the ARGUMENTS dict, so I end up with env['CPPPATH']
= 'my/second/path', where the value is a string, and I've lost the first
argument.
In the second case, it doesn't work because the entire argument is treated
like a string, so env['CPPPATH']='my/first/path,my/second/path'. I'd need
some sort of hook to parse the delimiter, and return a list, but the
converter arg doesn't seem appropriate because it is required to return a
string.
What I would like is a way to let the invoker list as many paths as
required for their environment, and end up with:
env['CPPATH']=['/my/first/path', '/my/second/path', ... '/my/nth/path']
Ideally I'd like to do this for many separate Variables that are best
handled as lists, like LIBPATH, CFLAGS, etc.
Any ideas? Otherwise I will need to use the Options mechanism instead, I
think.
Thanks,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140116/add4055b/attachment.html
More information about the Scons-users
mailing list