Skip to content

Commit 8dcc9d3

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]>
1 parent cc382b2 commit 8dcc9d3

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎mesonbuild/options.py‎

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

10651070
def set_from_configure_command(self, D_args: T.List[str], U_args: T.List[str]) -> bool:
10661071
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)