Skip to content

Commit

Permalink
parse_cmake: Also match hypen in pkg_check_modules(X)
Browse files Browse the repository at this point in the history
If a cmake file defines a pkgconfig dependency with a hypen in it, make
sure we can handle it:
pkg_check_modules(DBUS-1 REQUIRED dbus-1 IMPORTED_TARGET)

Previously we used \w to match the first term (DBUS-1), which does *not*
match hyphens.
  • Loading branch information
bwarden committed Oct 1, 2024
1 parent 965ebf1 commit 3f8e5e7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion autospec/buildreq.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ def parse_cmake(self, filename, cmake_modules, conf32):
"""Scan a .cmake or CMakeLists.txt file for what's it's actually looking for."""
findpackage = re.compile(r"^[^#]*find_package\((\w+)\b.*\)", re.I)
findpackage_multiline = re.compile(r"^[^#]*find_package\((\w+)\b.*", re.I)
pkgconfig = re.compile(r"^[^#]*pkg_check_modules\s*\(\w+ (.*)\)", re.I)
pkgconfig = re.compile(r"^[^#]*pkg_check_modules\s*\([\w\-]+ (.*)\)", re.I)
pkg_search_modifiers = {'REQUIRED', 'QUIET', 'NO_CMAKE_PATH',
'NO_CMAKE_ENVIRONMENT_PATH', 'IMPORTED_TARGET'}
extractword = re.compile(r'(?:"([^"]+)"|(\S+))(.*)')
Expand Down

0 comments on commit 3f8e5e7

Please sign in to comment.