diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2018-09-21 17:38:46 +0100 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2018-11-04 15:42:06 +0000 |
commit | bb31a8c1c752cff6f969e345f3a170f935f159cf (patch) | |
tree | e22055c7bade464334de3e7b2e3d23a1e7cd474c /mesonbuild/compilers/c.py | |
parent | e57fd018308e0ea5185391b3b6a76bb47479b7d7 (diff) | |
download | meson-bb31a8c1c752cff6f969e345f3a170f935f159cf.zip meson-bb31a8c1c752cff6f969e345f3a170f935f159cf.tar.gz meson-bb31a8c1c752cff6f969e345f3a170f935f159cf.tar.bz2 |
Only add link arguments when needed in Compiler object methods
Currently, ComplierHolder.determine_args() unconditionally adds the link
arguments to the commmand, even if we aren't linking, because it doesn't
have access to the mode (preprocess, compile, link) that
_get_compiler_check_args() will use.
This leads to command lines like:
'cl testfile.c /nologo /showIncludes /c /Fooutput.obj /Od kernel32.lib
user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib
uuid.lib comdlg32.lib advapi32.lib'
which clang-cl considers invalid; MSVS cl accepts this, ignoring the
unneeded libraries
Change from passing extra_args down to _get_compiler_check_args(), to
passing down a callback to CompilerHolder.determine_args() (with a bound
kwargs argument), so it can consult mode and kwargs to determine the args to
use.
Diffstat (limited to 'mesonbuild/compilers/c.py')
-rw-r--r-- | mesonbuild/compilers/c.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index d17dd3a..b41625c 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -392,6 +392,8 @@ class CCompiler(Compiler): return self.compiles(t.format(**fargs), env, extra_args, dependencies) def _get_compiler_check_args(self, env, extra_args, dependencies, mode='compile'): + if callable(extra_args): + extra_args = extra_args(mode) if extra_args is None: extra_args = [] elif isinstance(extra_args, str): |