summaryrefslogtreecommitdiff
path: root/mesonbuild/cmake/toolchain.py
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2022-09-11 18:35:02 -0400
committerEli Schwartz <eschwartz@archlinux.org>2022-09-19 15:18:59 -0400
commit0a9048e5546c17a926fd199ded798fba0f76b036 (patch)
tree0d6eb84d073fc271e39e178c49ef3b4afc922746 /mesonbuild/cmake/toolchain.py
parent24ac3cdb9c403fa43553cece086666f48ece1b95 (diff)
downloadmeson-0a9048e5546c17a926fd199ded798fba0f76b036.tar.gz
compilers: don't use instance checks to determine properties
In various situations we want to figure out what type of compiler we have, because we want to know stuff like "is it the pgi one", or "does it use msvc style". The compiler object has this property already, via an API specifically designed to communicate this info, but instead we performed isinstance checks on a compiler class. This is confusing and indirect, and has the side effect of requiring more imports everywhere. We should do away with it.
Diffstat (limited to 'mesonbuild/cmake/toolchain.py')
-rw-r--r--mesonbuild/cmake/toolchain.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/mesonbuild/cmake/toolchain.py b/mesonbuild/cmake/toolchain.py
index c854828a0..477629e81 100644
--- a/mesonbuild/cmake/toolchain.py
+++ b/mesonbuild/cmake/toolchain.py
@@ -16,7 +16,6 @@ from __future__ import annotations
from pathlib import Path
from .traceparser import CMakeTraceParser
from ..envconfig import CMakeSkipCompilerTest
-from ..compilers import VisualStudioLikeCompiler
from .common import language_map, cmake_get_generator_args
from .. import mlog
@@ -204,7 +203,7 @@ class CMakeToolchain:
@staticmethod
def is_cmdline_option(compiler: 'Compiler', arg: str) -> bool:
- if isinstance(compiler, VisualStudioLikeCompiler):
+ if compiler.get_argument_syntax() == 'msvc':
return arg.startswith('/')
else:
return arg.startswith('-')