summaryrefslogtreecommitdiffstats
path: root/doc/user/parse_flags_arg.xml
blob: 9e3ad8541445442635c18992fdb495ebfb5bf34e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?xml version='1.0'?>

<!--
SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
SPDX-License-Identifier: MIT
-->

<!DOCTYPE sconsdoc [
    <!ENTITY % scons SYSTEM "../scons.mod">
    %scons;

    <!ENTITY % builders-mod SYSTEM "../generated/builders.mod">
    %builders-mod;
    <!ENTITY % functions-mod SYSTEM "../generated/functions.mod">
    %functions-mod;
    <!ENTITY % tools-mod SYSTEM "../generated/tools.mod">
    %tools-mod;
    <!ENTITY % variables-mod SYSTEM "../generated/variables.mod">
    %variables-mod;
]>

<section id="sect-parse_flags_"
         xmlns="http://www.scons.org/dbxsd/v1.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd">
<title>Merging Options While Creating Environment: the <parameter>parse_flags</parameter> Parameter</title>

 <para>

 It is also possible to merge &consvar; values from arguments
 given to the &f-link-Environment; call itself.
 If the <parameter>parse_flags</parameter> keyword argument
 is given, its value is distributed to &consvars; in the
 new environment in the same way as
 described for the &MergeFlags; method.
 This also works when calling &f-link-env-Clone;,
 as well as in overrides to builder methods
 (see <xref linkend="builder_overrides"/>).

 </para>

 <scons_example name="parse_flags_ex1">
   <file name="SConstruct" printme="1">
env = Environment(parse_flags="-I/opt/include -L/opt/lib -lfoo")
for k in ('CPPPATH', 'LIBPATH', 'LIBS'):
    print("%s:" % k, env.get(k))
env.Program("f1.c")
   </file>
   <file name="f1.c">
int main() { return 0; }
   </file>
 </scons_example>

 <scons_output example="parse_flags_ex1" os="posix" suffix="1">
    <scons_output_command>scons -Q</scons_output_command>
 </scons_output>

</section>