Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support pacman epoch in DetectVersion.cmake #842

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions cmake/DetectVersion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,14 @@ function(pacman_version version_output_var pacmanpackage)
)

if (version_result EQUAL 0)
if (version_output MATCHES "^(.*) (.*)-.*$")
set(${version_output_var} ${CMAKE_MATCH_2} PARENT_SCOPE)
message(STATUS "pacman version of ${pacmanpackage}: ${CMAKE_MATCH_2}")
# Possible output is `re2 1:20240702-2` (format spec https://wiki.archlinux.org/title/PKGBUILD#Version)
# `re2` is name
# `1` is epoch (optional)
# `20240702` is version
# `2` is release number
if (version_output MATCHES "^(.*) ([0-9]*:)?(.*)-.*$")
set(${version_output_var} ${CMAKE_MATCH_3} PARENT_SCOPE)
message(STATUS "pacman version of ${pacmanpackage}: ${CMAKE_MATCH_3}")
else()
set(${version_output_var} "NOT_FOUND")
endif()
Expand Down
Loading