Skip to content

Commit

Permalink
Fix broken cpp_info.location deduction due to unsanitized regex
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Dec 8, 2024
1 parent d366425 commit 61a4f46
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions conans/model/build_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,11 @@ def _find_matching(dirs, pattern):
elif ext == ".dll":
dll_location = _find_matching(bindirs, libname)
else:
regex_static = re.compile(rf"(?:lib)?{libname}(?:[._-].+)?\.(?:a|lib)")
regex_shared = re.compile(rf"(?:lib)?{libname}(?:[._-].+)?\.(?:so|dylib)")
regex_dll = re.compile(rf"(?:.+)?({libname}|{component_name})(?:.+)?\.dll")
lib_sanitized = re.escape(libname)
component_sanitized = re.escape(component_name)
regex_static = re.compile(rf"(?:lib)?{lib_sanitized}(?:[._-].+)?\.(?:a|lib)")
regex_shared = re.compile(rf"(?:lib)?{lib_sanitized}(?:[._-].+)?\.(?:so|dylib)")
regex_dll = re.compile(rf"(?:.+)?({lib_sanitized}|{component_sanitized})(?:.+)?\.dll")
static_location = _find_matching(libdirs, regex_static)
shared_location = _find_matching(libdirs, regex_shared)
if static_location or not shared_location:
Expand Down

0 comments on commit 61a4f46

Please sign in to comment.