aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-10-12 23:17:36 -0400
committerXavier Claessens <xclaesse@gmail.com>2022-03-22 17:20:48 -0400
commit999fb3d1e9d4affd95e3ff12039abf787b0b7acf (patch)
treef98fa35f10f6a0a950dc1631d5a3dd6417787b0a
parent34f442a365cabdec884b7e9c9631bef434b7f989 (diff)
downloadmeson-999fb3d1e9d4affd95e3ff12039abf787b0b7acf.zip
meson-999fb3d1e9d4affd95e3ff12039abf787b0b7acf.tar.gz
meson-999fb3d1e9d4affd95e3ff12039abf787b0b7acf.tar.bz2
coredata: Do not forget subproject's default_options
-rw-r--r--mesonbuild/coredata.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index f7d5ec0..74033a8 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -818,13 +818,16 @@ class CoreData:
self.copy_build_options_from_regular_ones()
def set_default_options(self, default_options: T.MutableMapping[OptionKey, str], subproject: str, env: 'Environment') -> None:
+ # Main project can set default options on subprojects, but subprojects
+ # can only set default options on themself.
# Preserve order: if env.options has 'buildtype' it must come after
# 'optimization' if it is in default_options.
- options: T.MutableMapping[OptionKey, T.Any]
- if not subproject:
- options = OrderedDict(default_options)
- options.update(env.options)
- env.options = options
+ options: T.MutableMapping[OptionKey, T.Any] = OrderedDict()
+ for k, v in default_options.items():
+ if not subproject or k.subproject == subproject:
+ options[k] = v
+ options.update(env.options)
+ env.options = options
# Create a subset of options, keeping only project and builtin
# options for this subproject.
@@ -833,7 +836,7 @@ class CoreData:
# to know which backend we'll use).
options = OrderedDict()
- for k, v in chain(default_options.items(), env.options.items()):
+ for k, v in env.options.items():
# If this is a subproject, don't use other subproject options
if k.subproject and k.subproject != subproject:
continue