aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/compilers.py
diff options
context:
space:
mode:
authorOle André Vadla RavnÄs <oleavr@gmail.com>2017-05-21 20:35:44 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2017-05-21 23:04:19 +0300
commitb595cda4ed0ca699da3052a6bd30ba7d1dae1124 (patch)
tree587c4654ebe3d2956fdca855c23f62f32e5fa346 /mesonbuild/compilers.py
parent5794f37af5c5ce0010168d163f2568d7581b5a13 (diff)
downloadmeson-b595cda4ed0ca699da3052a6bd30ba7d1dae1124.zip
meson-b595cda4ed0ca699da3052a6bd30ba7d1dae1124.tar.gz
meson-b595cda4ed0ca699da3052a6bd30ba7d1dae1124.tar.bz2
Fix cross environment pollution.
Environment variables like CFLAGS and LDFLAGS should not affect the cross environment. Fixes #1772
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r--mesonbuild/compilers.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 97a1064..86ed2f4 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -956,15 +956,16 @@ class CCompiler(Compiler):
args += self.get_linker_debug_crt_args()
# Read c_args/cpp_args/etc from the cross-info file (if needed)
args += self.get_cross_extra_flags(env, link=(mode == 'link'))
- if mode == 'preprocess':
- # Add CPPFLAGS from the env.
- args += env.coredata.external_preprocess_args[self.language]
- elif mode == 'compile':
- # Add CFLAGS/CXXFLAGS/OBJCFLAGS/OBJCXXFLAGS from the env
- args += env.coredata.external_args[self.language]
- elif mode == 'link':
- # Add LDFLAGS from the env
- args += env.coredata.external_link_args[self.language]
+ if not self.is_cross:
+ if mode == 'preprocess':
+ # Add CPPFLAGS from the env.
+ args += env.coredata.external_preprocess_args[self.language]
+ elif mode == 'compile':
+ # Add CFLAGS/CXXFLAGS/OBJCFLAGS/OBJCXXFLAGS from the env
+ args += env.coredata.external_args[self.language]
+ elif mode == 'link':
+ # Add LDFLAGS from the env
+ args += env.coredata.external_link_args[self.language]
args += self.get_compiler_check_args()
# extra_args must override all other arguments, so we add them last
args += extra_args