aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/interpreter.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/interpreter/interpreter.py')
-rw-r--r--mesonbuild/interpreter/interpreter.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index 0526f9f..f6133b7 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -1128,23 +1128,30 @@ class Interpreter(InterpreterBase, HoldableObject):
# The backend is already set when parsing subprojects
if self.backend is not None:
return
- backend = self.coredata.get_option(OptionKey('backend'))
from ..backend import backends
- self.backend = backends.get_backend_from_name(backend, self.build, self)
+
+ if OptionKey('genvslite') in self.user_defined_options.cmd_line_options.keys():
+ # Use of the '--genvslite vsxxxx' option ultimately overrides any '--backend xxx'
+ # option the user may specify.
+ backend_name = self.coredata.get_option(OptionKey('genvslite'))
+ self.backend = backends.get_genvslite_backend(backend_name, self.build, self)
+ else:
+ backend_name = self.coredata.get_option(OptionKey('backend'))
+ self.backend = backends.get_backend_from_name(backend_name, self.build, self)
if self.backend is None:
- raise InterpreterException(f'Unknown backend "{backend}".')
- if backend != self.backend.name:
+ raise InterpreterException(f'Unknown backend "{backend_name}".')
+ if backend_name != self.backend.name:
if self.backend.name.startswith('vs'):
mlog.log('Auto detected Visual Studio backend:', mlog.bold(self.backend.name))
if not self.environment.first_invocation:
- raise MesonBugException(f'Backend changed from {backend} to {self.backend.name}')
+ raise MesonBugException(f'Backend changed from {backend_name} to {self.backend.name}')
self.coredata.set_option(OptionKey('backend'), self.backend.name, first_invocation=True)
# Only init backend options on first invocation otherwise it would
# override values previously set from command line.
if self.environment.first_invocation:
- self.coredata.init_backend_options(backend)
+ self.coredata.init_backend_options(backend_name)
options = {k: v for k, v in self.environment.options.items() if k.is_backend()}
self.coredata.set_options(options)