From fa415c54a0f7d9068b7ac74ec9506e428600e9ab Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Thu, 21 Dec 2017 13:20:26 +0000 Subject: [PATCH] Update prefix-dependent defaults when project(default_options:) changes prefix Fixes #2811 --- mesonbuild/interpreter.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index f33d437bf..5b4d30160 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1813,9 +1813,18 @@ to directly access options of other subprojects.''') if coredata.is_builtin_option(key): if self.subproject != '': continue # Only the master project is allowed to set global options. + # If this was set on the command line, do not override. if not self.environment.had_argument_for(key): self.coredata.set_builtin_option(key, value) - # If this was set on the command line, do not override. + # If we are setting the prefix, then other options which + # have prefix-dependent defaults need their value updating, + # if they haven't been explicitly set (i.e. have their + # default value) + if key == 'prefix': + for option in coredata.builtin_dir_noprefix_options: + if not (self.environment.had_argument_for(option) or + any([k.startswith(option + '=') for k in default_options])): + self.coredata.set_builtin_option(option, coredata.get_builtin_option_default(option, value)) else: # Option values set with subproject() default_options override those # set in project() default_options.