aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2019-11-26 15:00:32 -0800
committerDylan Baker <dylan@pnwbakers.com>2019-12-02 13:39:37 -0800
commit5a83cb0d33e96f19e05b2c83dae314a35ec9d5c1 (patch)
tree82903a58ab3449f4ae42627e4b74bad757fd6ec0 /mesonbuild/environment.py
parent52aa24e99733c2ad5da57f436823dbe56ca2164a (diff)
downloadmeson-5a83cb0d33e96f19e05b2c83dae314a35ec9d5c1.zip
meson-5a83cb0d33e96f19e05b2c83dae314a35ec9d5c1.tar.gz
meson-5a83cb0d33e96f19e05b2c83dae314a35ec9d5c1.tar.bz2
Fix detection of D linker in MSVC environments
Rather than trying to figure out if we're using MSVC based on environment variables, then trying to get the C compiler and test some attributes, get the C compiler and see if it's MSVC. This is much more reliable and we were already doing it anyway.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index d81f34f..8459d64 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -1339,10 +1339,11 @@ class Environment:
info = self.machines[for_machine]
# Detect the target architecture, required for proper architecture handling on Windows.
- c_compiler = {}
- is_msvc = mesonlib.is_windows() and 'VCINSTALLDIR' in os.environ
- if is_msvc:
- c_compiler = {'c': self.detect_c_compiler(for_machine)} # MSVC compiler is required for correct platform detection.
+ # MSVC compiler is required for correct platform detection.
+ c_compiler = {'c': self.detect_c_compiler(for_machine)}
+ is_msvc = isinstance(c_compiler['c'], VisualStudioCCompiler)
+ if not is_msvc:
+ c_compiler = {}
arch = detect_cpu_family(c_compiler)
if is_msvc and arch == 'x86':