4 SPDX-FileCopyrightText: Copyright The SCons Foundation (https://scons.org)
5 SPDX-License-Identifier: MIT
6 SPDX-FileType: DOCUMENTATION
8 This file is processed by the bin/SConsDoc.py module.
12 <!ENTITY % scons SYSTEM "../scons.mod">
15 <!ENTITY % builders-mod SYSTEM "../generated/builders.mod">
17 <!ENTITY % functions-mod SYSTEM "../generated/functions.mod">
19 <!ENTITY % tools-mod SYSTEM "../generated/tools.mod">
21 <!ENTITY % variables-mod SYSTEM "../generated/variables.mod">
25 <section id="sect-parse_flags_"
26 xmlns="http://www.scons.org/dbxsd/v1.0"
27 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
28 xsi:schemaLocation="http://www.scons.org/dbxsd/v1.0 http://www.scons.org/dbxsd/v1.0/scons.xsd">
29 <title>Merging Options While Creating Environment: the <parameter>parse_flags</parameter> Parameter</title>
33 It is also possible to merge &consvar; values from arguments
34 given to the &f-link-Environment; call itself.
35 If the <parameter>parse_flags</parameter> keyword argument
36 is given, its value is distributed to &consvars; in the
37 new environment in the same way as
38 described for the &MergeFlags; method.
39 This also works when calling &f-link-env-Clone;,
40 as well as in overrides to builder methods
41 (see <xref linkend="builder_overrides"/>).
45 <scons_example name="parse_flags_ex1">
46 <file name="SConstruct" printme="1">
47 env = Environment(parse_flags="-I/opt/include -L/opt/lib -lfoo")
48 for k in ('CPPPATH', 'LIBPATH', 'LIBS'):
49 print("%s:" % k, env.get(k))
53 int main() { return 0; }
57 <scons_output example="parse_flags_ex1" os="posix" suffix="1">
58 <scons_output_command>scons -Q</scons_output_command>