diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-03-24 19:43:21 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2017-04-04 23:38:36 +0530 |
commit | 6042e21e25e31d4bb794ab83237beac511a15837 (patch) | |
tree | 09934d50be897233b3044ce3fbf995ebd273a164 /mesonbuild/compilers.py | |
parent | 09fee02dd9484e682401469ff890cf99ef5fa56a (diff) | |
download | meson-6042e21e25e31d4bb794ab83237beac511a15837.zip meson-6042e21e25e31d4bb794ab83237beac511a15837.tar.gz meson-6042e21e25e31d4bb794ab83237beac511a15837.tar.bz2 |
Use CPPFLAGS for pre-processor compiler checks
Also don't add CFLAGS twice for links() checks
Includes a test for this.
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r-- | mesonbuild/compilers.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index ce3f09a..6f08d98 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -953,12 +953,14 @@ class CCompiler(Compiler): # Read c_args/cpp_args/etc from the cross-info file (if needed) args += self.get_cross_extra_flags(env, compile=(mode != 'preprocess'), link=(mode == 'link')) - # Add CFLAGS/CXXFLAGS/OBJCFLAGS/OBJCXXFLAGS from the env - # We assume that the user has ensured these are compiler-specific - args += env.coredata.external_args[self.language] - # Add LDFLAGS from the env. We assume that the user has ensured these - # are compiler-specific - if 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] args += self.get_compiler_check_args() # extra_args must override all other arguments, so we add them last |