FindRuby: Fix incorrect code and versions

This commit is contained in:
Charlie Savage
2025-12-20 21:28:09 -08:00
committed by Brad King
parent deb67fa837
commit 752d5cace6

View File

@@ -420,12 +420,12 @@ if (Ruby_EXECUTABLE AND NOT Ruby_VERSION_MAJOR)
# check whether we found 2.[0-7].x
if (${Ruby_EXECUTABLE} MATCHES "ruby2")
set(Ruby_VERSION_MAJOR 2)
string(REGEX_REPLACE ${Ruby_EXECUTABLE} "ruby2\\.?([0-7])" "\\1" Ruby_VERSION_MINOR)
string(REGEX REPLACE ${Ruby_EXECUTABLE} "ruby2\\.?([0-7])" "\\1" Ruby_VERSION_MINOR)
endif ()
# check whether we found 3.[0-1].x
# check whether we found 3.[0-4].x
if (${Ruby_EXECUTABLE} MATCHES "ruby3")
set(Ruby_VERSION_MAJOR 3)
string(REGEX_REPLACE ${Ruby_EXECUTABLE} "ruby3\\.?([0-1])" "\\1" Ruby_VERSION_MINOR)
string(REGEX REPLACE ${Ruby_EXECUTABLE} "ruby3\\.?([0-4])" "\\1" Ruby_VERSION_MINOR)
endif ()
endif ()