aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorFlorian Schmaus <flo@geekplace.eu>2021-07-26 00:10:58 +0200
committerGitHub <noreply@github.com>2021-07-26 01:10:58 +0300
commitdbf2ace6ca1ce39aa01497f815b65856079cc581 (patch)
treeb4b9b7cfacc52b3f16f68963d278225c1026cb75 /mesonbuild
parentbf41d56597349a7047f2034e3e3e00d4502220cc (diff)
downloadmeson-dbf2ace6ca1ce39aa01497f815b65856079cc581.zip
meson-dbf2ace6ca1ce39aa01497f815b65856079cc581.tar.gz
meson-dbf2ace6ca1ce39aa01497f815b65856079cc581.tar.bz2
coredata: throw a MesonException on unknown options
Fixes #7288.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/coredata.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index c2604be..37d830d 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -758,7 +758,7 @@ class CoreData:
except KeyError:
continue
- def set_options(self, options: T.Dict[OptionKey, T.Any], subproject: str = '', warn_unknown: bool = True) -> None:
+ def set_options(self, options: T.Dict[OptionKey, T.Any], subproject: str = '') -> None:
if not self.is_cross_build():
options = {k: v for k, v in options.items() if k.machine is not MachineChoice.BUILD}
# Set prefix first because it's needed to sanitize other options
@@ -774,16 +774,15 @@ class CoreData:
for k, v in options.items():
if k == pfk:
continue
- elif k not in self.options:
- unknown_options.append(k)
- else:
+ elif k in self.options:
self.set_option(k, v)
- if unknown_options and warn_unknown:
+ elif k.machine != MachineChoice.BUILD:
+ unknown_options.append(k)
+ if unknown_options:
unknown_options_str = ', '.join(sorted(str(s) for s in unknown_options))
sub = f'In subproject {subproject}: ' if subproject else ''
- mlog.warning(f'{sub}Unknown options: "{unknown_options_str}"')
- mlog.log('The value of new options can be set with:')
- mlog.log(mlog.bold('meson setup <builddir> --reconfigure -Dnew_option=new_value ...'))
+ raise MesonException(f'{sub}Unknown options: "{unknown_options_str}"')
+
if not self.is_cross_build():
self.copy_build_options_from_regular_ones()