Skip to content

Commit

Permalink
Try to fix #14189.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpakkane committed Feb 5, 2025
1 parent f2abd9c commit f7dafda
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mesonbuild/interpreter/interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def __init__(
self.configure_file_outputs: T.Dict[str, int] = {}
# Passed from the outside, only used in subprojects.
if default_project_options:
self.default_project_options = default_project_options.copy()
self.default_project_options = default_project_options if isinstance(default_project_options, str) else default_project_options.copy()
if isinstance(default_project_options, dict):
pass
else:
Expand Down
2 changes: 2 additions & 0 deletions mesonbuild/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1285,6 +1285,8 @@ def initialize_from_subproject_call(self, subproject, spcall_default_options, pr
is_first_invocation = True
spcall_default_options = self.hacky_mchackface_back_to_list(spcall_default_options)
project_default_options = self.hacky_mchackface_back_to_list(project_default_options)
if isinstance(spcall_default_options, str):
spcall_default_options = [spcall_default_options]
for o in itertools.chain(project_default_options, spcall_default_options):
keystr, valstr = o.split('=', 1)
key = OptionKey.from_string(keystr)
Expand Down
2 changes: 1 addition & 1 deletion test cases/common/87 default options/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ assert(w_level == '3', 'warning level "' + w_level + '" instead of "3"')
# assert(cc.compiles('int foobar;', no_builtin_args : true), 'No_builtin did not disable builtins.')
# endif

subproject('sub1')
subproject('sub1', default_options: 'func_test_option=true')
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
project('sub1')

assert(get_option('test_option') == false)
assert(get_option('func_test_option') == true)
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
option('test_option', type : 'boolean', value : true, description : 'Test option. Superproject overrides default to "false"')
option('func_test_option', type : 'boolean', value : false, description : 'Test option. Superproject overrides default to "true"')

0 comments on commit f7dafda

Please sign in to comment.