summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Brunet <charles.brunet@optelgroup.com>2024-03-06 07:26:25 -0500
committerDylan Baker <dylan@pnwbakers.com>2024-03-10 13:09:32 -0700
commit9e270f030f3016be2a419b698b8062e5ed5373b8 (patch)
tree266555b8dcc93fa06e66714572b858ea1848385b
parent0cd74c96f1b58fe89ef9565ab40905d04538d7ed (diff)
downloadmeson-9e270f030f3016be2a419b698b8062e5ed5373b8.tar.gz
Fix detection of unknown base options in subproj
cc4cfbcad92945a1629c80664e1eb755c68905dd added detection for unknown base options, but it was not working for subproject base options. This should fix it.
-rw-r--r--mesonbuild/coredata.py2
-rw-r--r--test cases/unit/122 reconfigure base options/meson.build2
-rw-r--r--test cases/unit/122 reconfigure base options/subprojects/sub/meson.build5
-rw-r--r--unittests/platformagnostictests.py2
4 files changed, 9 insertions, 2 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index bb155d033..f2ea87993 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -1009,7 +1009,7 @@ class CoreData:
# adding languages and setting backend.
if k.type in {OptionType.COMPILER, OptionType.BACKEND}:
continue
- if k.type == OptionType.BASE and k in base_options:
+ if k.type == OptionType.BASE and k.as_root() in base_options:
# set_options will report unknown base options
continue
options[k] = v
diff --git a/test cases/unit/122 reconfigure base options/meson.build b/test cases/unit/122 reconfigure base options/meson.build
index 67e83d1e4..8a13b78b2 100644
--- a/test cases/unit/122 reconfigure base options/meson.build
+++ b/test cases/unit/122 reconfigure base options/meson.build
@@ -1,5 +1,7 @@
project('reconfigure', 'c',
default_options: ['c_std=c89'])
+subproject('sub')
+
message('b_ndebug: ' + get_option('b_ndebug'))
message('c_std: ' + get_option('c_std'))
diff --git a/test cases/unit/122 reconfigure base options/subprojects/sub/meson.build b/test cases/unit/122 reconfigure base options/subprojects/sub/meson.build
new file mode 100644
index 000000000..ba740d1ca
--- /dev/null
+++ b/test cases/unit/122 reconfigure base options/subprojects/sub/meson.build
@@ -0,0 +1,5 @@
+project('sub', 'c',
+default_options: ['c_std=c89'])
+
+message('b_ndebug: ' + get_option('b_ndebug'))
+message('c_std: ' + get_option('c_std'))
diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py
index 21cb3b945..a6db17341 100644
--- a/unittests/platformagnostictests.py
+++ b/unittests/platformagnostictests.py
@@ -282,7 +282,7 @@ class PlatformAgnosticTests(BasePlatformTests):
self.assertIn('\nMessage: b_ndebug: true\n', out)
self.assertIn('\nMessage: c_std: c89\n', out)
- out = self.init(testdir, extra_args=['--reconfigure', '-Db_ndebug=if-release', '-Dc_std=c99'])
+ out = self.init(testdir, extra_args=['--reconfigure', '-Db_ndebug=if-release', '-Dsub:b_ndebug=false', '-Dc_std=c99'])
self.assertIn('\nMessage: b_ndebug: if-release\n', out)
self.assertIn('\nMessage: c_std: c99\n', out)