diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-03-23 20:52:49 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-03-30 18:52:17 +0300 |
commit | 2cd0723c42ae2076c7ba2b888fd7a5235d5cbf17 (patch) | |
tree | 8a403fc8589838c8305f34cdb22b0e8db72ea8ce /mesonbuild/compilers/compilers.py | |
parent | 692f6733122b2bf053299f8a0cdbcab3d5bfbfb5 (diff) | |
download | meson-2cd0723c42ae2076c7ba2b888fd7a5235d5cbf17.zip meson-2cd0723c42ae2076c7ba2b888fd7a5235d5cbf17.tar.gz meson-2cd0723c42ae2076c7ba2b888fd7a5235d5cbf17.tar.bz2 |
Split environment variable and command line cflags
They are supposed to have different behavior. The environment variables
apply to both the compiler and linker when the compiler acts as a
linker, but the command line ones do not.
Fixes #8345
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index a8a7cd1..b06f6a5 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1234,18 +1234,21 @@ def get_global_options(lang: str, description = f'Extra arguments passed to the {lang}' argkey = OptionKey('args', lang=lang, machine=for_machine) largkey = argkey.evolve('link_args') + envkey = argkey.evolve('env_args') cargs = coredata.UserArrayOption( description + ' compiler', env.options.get(argkey, []), split_args=True, user_input=True, allow_dups=True) + # the compiler args always gets the environemtn variable arguments + cargs.extend_value(env.options.get(envkey, [])) + largs = coredata.UserArrayOption( description + ' linker', env.options.get(largkey, []), split_args=True, user_input=True, allow_dups=True) - - # This needs to be done here, so that if we have string values in the env - # options that we can safely combine them *after* they've been split + # The linker gets the compiler environment variable only if the comiler + # acts as the linker if comp.INVOKES_LINKER: - largs.set_value(largs.value + cargs.value) + largs.extend_value(env.options.get(envkey, [])) opts: 'KeyedOptionDictType' = {argkey: cargs, largkey: largs} |