From 56a6ee1e5d51ca71a9188e6cbdcf8a2ce611cf2b Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 28 Sep 2022 00:44:32 -0400 Subject: 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 --- mesonbuild/compilers/mixins/clike.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'mesonbuild/compilers') 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 -- cgit v1.1