diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2021-03-23 20:52:49 -0700 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2021-03-30 17:35:56 +0300 |
commit | 0b54b81222f092bd859b08af993e2700bddd81be (patch) | |
tree | 8eb6042107883a5685a9a4db3296a2a01a91151d /mesonbuild/compilers/compilers.py | |
parent | e80ff985fb1d4a0b840e5bf67a7e5dff08a21cdd (diff) | |
download | meson-envvarfixup.zip meson-envvarfixup.tar.gz meson-envvarfixup.tar.bz2 |
Split environment variable and command line cflagsenvvarfixup
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} |