diff options
author | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2016-05-31 00:27:58 +0530 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-05-30 21:57:58 +0300 |
commit | 9f4d963bd98cc4cecac48abf7341fc8808dd859f (patch) | |
tree | 0f76a95d69ba7792a7f877444fb4a2a8c38a0bd5 | |
parent | beb68274138e6f6140c03709c59b57379a94a7c0 (diff) | |
download | meson-9f4d963bd98cc4cecac48abf7341fc8808dd859f.zip meson-9f4d963bd98cc4cecac48abf7341fc8808dd859f.tar.gz meson-9f4d963bd98cc4cecac48abf7341fc8808dd859f.tar.bz2 |
compilers: Add the buildtype args for checks that perform linking (#543)
This is required for checking for compiler checks that involve linking
to a static library with MSVC. Without this, MSVC errors out since no
CRT is specified.
-rw-r--r-- | mesonbuild/compilers.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index cf480c4..03ef9f9 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -533,7 +533,12 @@ int main () {{ {1}; }}''' ofile = open(srcname, 'w') ofile.write(code) ofile.close() - extra_args = self.unix_link_flags_to_native(extra_args) + \ + # Need to add buildtype args to select the CRT to use with MSVC + # This is needed especially while trying to link with static libraries + # since MSVC won't auto-select a CRT for us in that case and will error + # out asking us to select one. + extra_args = self.get_buildtype_args('debug') + \ + self.unix_link_flags_to_native(extra_args) + \ self.get_output_args(dstname) p = self.compile(code, srcname, extra_args) try: @@ -553,6 +558,8 @@ int main () {{ {1}; }}''' ofile.close() exename = srcname + '.exe' # Is guaranteed to be executable on every platform. commands = self.get_exelist() + # Same reasoning as self.links() above + commands += self.get_buildtype_args('debug') commands += self.unix_link_flags_to_native(extra_args) commands.append(srcname) commands += self.get_output_args(exename) |