Skip to content

Commit f372a56

Browse files
bonzinieli-schwartz
authored andcommitted
options: accept compiler and built-in options in --reconfigure and "meson configure"
Follow the same logic that is used at the end of the first invocation. This fixes meson setup --reconfigure -Db_ndebug=true on a project that has no language that defines b_ndebug. Signed-off-by: Paolo Bonzini <[email protected]> (cherry picked from commit 8dcc9d3)
1 parent ac06686 commit f372a56

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

mesonbuild/options.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,8 +1057,13 @@ def replace(v: str) -> str:
10571057
def set_option_maybe_root(self, o: OptionKey, new_value: str) -> bool:
10581058
if o in self.options:
10591059
return self.set_option(o, new_value)
1060-
o = o.as_root()
1061-
return self.set_option(o, new_value)
1060+
if self.accept_as_pending_option(o):
1061+
old_value = self.pending_options.get(o, None)
1062+
self.pending_options[o] = new_value
1063+
return old_value is None or str(old_value) == new_value
1064+
else:
1065+
o = o.as_root()
1066+
return self.set_option(o, new_value)
10621067

10631068
def set_from_configure_command(self, D_args: T.List[str], U_args: T.List[str]) -> bool:
10641069
dirty = False

unittests/optiontests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ def test_b_nonexistent(self):
208208
assert optstore.accept_as_pending_option(OptionKey('b_ndebug'))
209209
assert not optstore.accept_as_pending_option(OptionKey('b_whatever'))
210210

211+
def test_reconfigure_b_nonexistent(self):
212+
optstore = OptionStore(False)
213+
optstore.set_from_configure_command(['b_ndebug=true'], [])
214+
211215
def test_subproject_nonexistent(self):
212216
optstore = OptionStore(False)
213217
subprojects = {'found'}

0 commit comments

Comments
 (0)