[Scons-users] passing variables on the command-line

Stefan Seefeld stefan at seefeld.name
Fri Jun 17 14:10:07 EDT 2016


Answering my own question again:

It seems

    vars.Add('CCFLAGS', converter=lambda v:v.split())

does what I want.

        Stefan



On 17.06.2016 13:54, Stefan Seefeld wrote:
> In my current build logic I save variables (user-provided as well as
> configure-computed) to a 'config.py' file. To do this I add
>
>
>   vars.Add('CPPPATH')
>
>
> etc. to my SConstruct file, so these variables get properly remembered.
> After running `scons` the first time (where the configure logic issues a
> number of env.AddUnique(CCFLAGS='something') calls, I get this in my
> config.py file:
>
>
>   CPPPATH = ['/usr/include/python2.7']
>   CCFLAGS = []
>   LIBPATH = ['/usr/lib64']
>   LIBS = []
>   PYTHON = 'python'
>   PYTHONLIBS = ['python2.7']
>
>
> However, if I run instead something like `scons CCFLAGS=-Wall -W` the
> result is
>
>
> ...
>
> CCFLAGS = '-Wall -W'
>
> ...
>
>
> How can I instruct SCons to transform the 'CCFLAGS' variable issued on
> the command-line into a list, so the individual flags are understood
> when this is passed to the compiler ?
>
>
> Thanks,
>
>         Stefan
>
>


-- 

      ...ich hab' noch einen Koffer in Berlin...



More information about the Scons-users mailing list