diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-09-28 00:44:32 -0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2022-09-28 12:53:46 +0300 |
commit | 56a6ee1e5d51ca71a9188e6cbdcf8a2ce611cf2b (patch) | |
tree | d78b92abb8daabb1a32ba5d64aa34bfce4d89d20 /mesonbuild | |
parent | 05da4b087c06cdac7f916128aa0796a1c2ef515a (diff) | |
download | meson-56a6ee1e5d51ca71a9188e6cbdcf8a2ce611cf2b.zip meson-56a6ee1e5d51ca71a9188e6cbdcf8a2ce611cf2b.tar.gz meson-56a6ee1e5d51ca71a9188e6cbdcf8a2ce611cf2b.tar.bz2 |
find_library with argument beginning in "lib" is a bad idea, warn about it
We need to support cases where the library might be called "foo.so" and
therefore we check for exact matches too. But this also allows
`cc.find_library('libfoo')` to find libfoo.so, which is strange and
won't work in many cases. Emit a warning when this happens.
Fixes #10838
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers/mixins/clike.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index 87f5dcf..0efc3fb 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -1158,6 +1158,8 @@ class CLikeCompiler(Compiler): trial = self._get_file_from_list(env, trials) if not trial: continue + if libname.startswith('lib') and trial.name.startswith(libname): + mlog.warning(f'find_library({libname!r}) starting in "lib" only works by accident and is not portable') return [trial.as_posix()] return None |