aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/interpreter.py
diff options
context:
space:
mode:
authorNiklas Claesson <nicke.claesson@gmail.com>2019-03-11 19:56:52 +0100
committerJussi Pakkanen <jpakkane@gmail.com>2019-03-11 20:56:52 +0200
commitdd2c44cdf6f8ed8a969d0666cafb08aaf78a919d (patch)
treea6057cb899b43c55a820291c93dd62d61e2e0a69 /mesonbuild/interpreter.py
parentfaf3581df6af59c04e66378da129bb2039beab8a (diff)
downloadmeson-dd2c44cdf6f8ed8a969d0666cafb08aaf78a919d.zip
meson-dd2c44cdf6f8ed8a969d0666cafb08aaf78a919d.tar.gz
meson-dd2c44cdf6f8ed8a969d0666cafb08aaf78a919d.tar.bz2
Add static as keyword to find_library
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r--mesonbuild/interpreter.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index e48733a..3c3cfae 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -919,6 +919,7 @@ find_library_permitted_kwargs = set([
'has_headers',
'required',
'dirs',
+ 'static',
])
find_library_permitted_kwargs |= set(['header_' + k for k in header_permitted_kwargs])
@@ -1463,6 +1464,7 @@ class CompilerHolder(InterpreterObject):
silent=True)
return ExternalLibraryHolder(lib, self.subproject)
+ @FeatureNewKwargs('compiler.find_library', '0.51.0', ['static'])
@FeatureNewKwargs('compiler.find_library', '0.50.0', ['has_headers'])
@FeatureNewKwargs('compiler.find_library', '0.49.0', ['disabler'])
@disablerIfNotFound
@@ -1491,9 +1493,15 @@ class CompilerHolder(InterpreterObject):
for i in search_dirs:
if not os.path.isabs(i):
raise InvalidCode('Search directory %s is not an absolute path.' % i)
- linkargs = self.compiler.find_library(libname, self.environment, search_dirs)
+ libtype = 'shared-static'
+ if 'static' in kwargs:
+ if not isinstance(kwargs['static'], bool):
+ raise InterpreterException('static must be a boolean')
+ libtype = 'static' if kwargs['static'] else 'shared'
+ linkargs = self.compiler.find_library(libname, self.environment, search_dirs, libtype)
if required and not linkargs:
- raise InterpreterException('{} library {!r} not found'.format(self.compiler.get_display_language(), libname))
+ raise InterpreterException(
+ '{} library {!r} not found'.format(self.compiler.get_display_language(), libname))
lib = dependencies.ExternalLibrary(libname, linkargs, self.environment,
self.compiler.language)
return ExternalLibraryHolder(lib, self.subproject)