diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-03-02 20:39:28 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-03-12 17:00:55 +0200 |
commit | 6b548a1c7587238415e32cde6121b071ebee490c (patch) | |
tree | 70a1268cfcab89aac3fb27ea9160d1caac8d7c69 /mesonbuild/compilers.py | |
parent | 0d5eaa27218573f887013fb5bb40f435d34f745e (diff) | |
download | meson-6b548a1c7587238415e32cde6121b071ebee490c.zip meson-6b548a1c7587238415e32cde6121b071ebee490c.tar.gz meson-6b548a1c7587238415e32cde6121b071ebee490c.tar.bz2 |
Added find_library method and deprecated the standalone version. Closes #396.
Diffstat (limited to 'mesonbuild/compilers.py')
-rw-r--r-- | mesonbuild/compilers.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 9b753dd..aba4b95 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -190,6 +190,9 @@ class Compiler(): def unix_compile_flags_to_native(self, args): return args + def find_library(self, libname): + raise EnvironmentException('Language {} does not support library finding.'.format(self.language)) + class CCompiler(Compiler): def __init__(self, exelist, version, is_cross, exe_wrapper=None): super().__init__(exelist, version) @@ -563,6 +566,16 @@ void bar() { ''' return self.compiles(templ % (prefix, typename), extra_args) + def find_library(self, libname): + code = '''int main(int argc, char **argv) { + return 0; +} + ''' + linkarg = '-l' + libname + if self.links(code, extra_args=[linkarg]): + return linkarg + return None + def thread_flags(self): return ['-pthread'] |