aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter/dependencyfallbacks.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-08-04 11:30:27 -0400
committerXavier Claessens <xclaesse@gmail.com>2021-08-23 10:52:18 -0400
commite646130ef1a703a3624cff4ca11f926703a6fcf4 (patch)
treeafc6527bdd1e01de853fa4ecdab66ee2a8baf75b /mesonbuild/interpreter/dependencyfallbacks.py
parent0063eb251e836e777b427cbe59b43ab937ac1924 (diff)
downloadmeson-e646130ef1a703a3624cff4ca11f926703a6fcf4.zip
meson-e646130ef1a703a3624cff4ca11f926703a6fcf4.tar.gz
meson-e646130ef1a703a3624cff4ca11f926703a6fcf4.tar.bz2
interpreter: Fix dependency(..., static: true) fallback
It should build the fallback subprject with default_library=static and override the dependency for both static=True and static kwarg not given. Fixes: #8050.
Diffstat (limited to 'mesonbuild/interpreter/dependencyfallbacks.py')
-rw-r--r--mesonbuild/interpreter/dependencyfallbacks.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/mesonbuild/interpreter/dependencyfallbacks.py b/mesonbuild/interpreter/dependencyfallbacks.py
index 5934cbd..4baa5cf 100644
--- a/mesonbuild/interpreter/dependencyfallbacks.py
+++ b/mesonbuild/interpreter/dependencyfallbacks.py
@@ -116,6 +116,17 @@ class DependencyFallbacksHolder(MesonInterpreterObject):
mlog.log('Looking for a fallback subproject for the dependency',
mlog.bold(self.display_name))
+ # dependency('foo', static: true) should implicitly add
+ # default_options: ['default_library=static']
+ static = kwargs.get('static')
+ default_options = stringlistify(func_kwargs.get('default_options', []))
+ if static is not None and not any('default_library' in i for i in default_options):
+ default_library = 'static' if static else 'shared'
+ opt = f'default_library={default_library}'
+ mlog.log(f'Building fallback subproject with {opt}')
+ default_options.append(opt)
+ func_kwargs['default_options'] = default_options
+
# Configure the subproject
subp_name = self.subproject_name
varname = self.subproject_varname