From a85353cd8326175e719b913ff9aa46e3daf20497 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 27 Nov 2023 10:26:23 -0800 Subject: [PATCH] cmake: Handle compiler.find_library returning None I'm not 100% sure that warning is the appropriate action, but it's better than failing with a backtrace. Fixes: #12555 --- mesonbuild/cmake/tracetargets.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mesonbuild/cmake/tracetargets.py b/mesonbuild/cmake/tracetargets.py index bb5faa395..20c7462d1 100644 --- a/mesonbuild/cmake/tracetargets.py +++ b/mesonbuild/cmake/tracetargets.py @@ -55,7 +55,11 @@ def resolve_cmake_trace_targets(target_name: str, # CMake brute-forces a combination of prefix/suffix combinations to find the # right library. Assume any bare argument passed which is not also a CMake # target must be a system library we should try to link against. - res.libraries += clib_compiler.find_library(curr, env, []) + flib = clib_compiler.find_library(curr, env, []) + if flib is not None: + res.libraries += flib + else: + not_found_warning(curr) else: not_found_warning(curr) continue