diff options
Diffstat (limited to 'doc/user/command-line.xml')
-rw-r--r-- | doc/user/command-line.xml | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml index f06442e..a4a6107 100644 --- a/doc/user/command-line.xml +++ b/doc/user/command-line.xml @@ -1,6 +1,6 @@ <!-- - Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation + Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the @@ -62,7 +62,7 @@ Any command-line argument containing an <literal>=</literal> (equal sign) is considered a variable setting with the form - <varname>variable</varname>=<varname>value</varname> + <varname>variable</varname>=<varname>value</varname>. &SCons; provides direct access to all of the command-line variable settings, the ability to apply command-line variable settings @@ -875,7 +875,7 @@ </para> <programlisting> - vars = Variables() + vars = Variables(None, ARGUMENTS) vars.Add('RELEASE', 'Set to 1 to build for release', 0) env = Environment(variables = vars, CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) @@ -885,8 +885,9 @@ <para> This &SConstruct; file first creates a &Variables; object - (the <literal>vars = Variables()</literal> call), - and then uses the object's &Add; + which uses the values from the command-line options dictionary &ARGUMENTS; + (the <literal>vars = Variables(None, ARGUMENTS)</literal> call). + It then uses the object's &Add; method to indicate that the &RELEASE; variable can be set on the command line, and that its default value will be <literal>0</literal> @@ -928,7 +929,7 @@ &PathOption;, &PackageOption; and &AddOptions;. These older names still work, and you may encounter them in older - &SConscript; fles, + &SConscript; files, but they have been officially deprecated as of &SCons; version 2.0. @@ -960,7 +961,7 @@ </para> <programlisting> - vars = Variables('custom.py') + vars = Variables(None, ARGUMENTS) vars.Add('RELEASE', 'Set to 1 to build for release', 0) env = Environment(variables = vars) Help(vars.GenerateHelpText(env)) @@ -1069,6 +1070,23 @@ cc -o foo foo.o bar.o </screen> + <para> + + Finally, you can combine both methods with: + + </para> + + <screen> + vars = Variables('custom.py', ARGUMENTS) + </screen> + + <para> + + where values in the option file &custom_py; get overwritten + by the ones specified on the command line. + + </para> + </section> <section> |