scons_gd/scons/doc/user/parse_flags_arg.xml
2022-10-15 16:06:26 +02:00

78 lines
2.7 KiB
XML

<?xml version='1.0'?>
<!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>
<!--
__COPYRIGHT__
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-->
<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>