diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py index b20aca1ee6ff..9892d72e6cbf 100644 --- a/mesonbuild/dependencies/dev.py +++ b/mesonbuild/dependencies/dev.py @@ -599,10 +599,18 @@ def __init__(self, name: str, env: Environment, kwargs: T.Dict[str, T.Any], lang libtype = mesonlib.LibType.PREFER_STATIC if self.static else mesonlib.LibType.PREFER_SHARED - for search in dirs: + # Sometimes (especially on Windows), the libs will have a suffix of the + # major version, so thigs like `clangBasic-8.lib` or + # `cygclangBasic-8.dll` + llvm = mesonlib.first(self.ext_deps, lambda x: x.name == 'llvm') + assert llvm is not None, 'for mypy' + assert llvm.version is not None, 'for mypy' + + for search, suffix in zip(dirs, ['', f'-{llvm.version.split(".")[0]}']): self.module_details.clear() libs: T.List[str] = [] for m in modules: + m = f'{m}{suffix}' lib = self.clib_compiler.find_library(m, env, search, libtype) if lib: libs.extend(lib) @@ -617,6 +625,7 @@ def __init__(self, name: str, env: Environment, kwargs: T.Dict[str, T.Any], lang continue for m in opt_modules: + m = f'{m}{suffix}' lib = self.clib_compiler.find_library(m, env, search, libtype) if lib: libs.extend(lib)