summaryrefslogtreecommitdiff
path: root/Modules/FindRuby.cmake
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2022-01-31 05:51:36 +0100
committerMihai Moldovan <ionic@ionic.de>2022-01-31 05:51:36 +0100
commit42d99a248ebd3a57d6962eed6d19559334b9a376 (patch)
tree61d2436205e17efed4ff073373b0a5b3bce0430e /Modules/FindRuby.cmake
parent4b033ca0eb486fa23f58e4df2f2a7d3539ca0a3f (diff)
downloadcmake-42d99a248ebd3a57d6962eed6d19559334b9a376.tar.gz
FindRuby: add support for versions up to 3.1.
Diffstat (limited to 'Modules/FindRuby.cmake')
-rw-r--r--Modules/FindRuby.cmake22
1 files changed, 16 insertions, 6 deletions
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index 759f57c22d..ec05ceab6b 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -8,7 +8,7 @@ FindRuby
Find Ruby
This module finds if Ruby is installed and determines where the
-include files and libraries are. Ruby 1.8 through 2.7 are
+include files and libraries are. Ruby 1.8 through 3.1 are
supported.
The minimum required version of Ruby can be specified using the
@@ -139,13 +139,13 @@ set(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${Ruby_FIND_VERSION
# Set name of possible executables, ignoring the minor
# Eg:
-# 2.1.1 => from ruby27 to ruby21 included
-# 2.1 => from ruby27 to ruby21 included
-# 2 => from ruby26 to ruby20 included
-# empty => from ruby27 to ruby18 included
+# 2.1.1 => from ruby31 to ruby21 included
+# 2.1 => from ruby31 to ruby21 included
+# 2 => from ruby31 to ruby20 included
+# empty => from ruby31 to ruby18 included
if(NOT Ruby_FIND_VERSION_EXACT)
- foreach(_ruby_version RANGE 27 18 -1)
+ foreach(_ruby_version RANGE 31 18 -1)
string(SUBSTRING "${_ruby_version}" 0 1 _ruby_major_version)
string(SUBSTRING "${_ruby_version}" 1 1 _ruby_minor_version)
@@ -398,6 +398,16 @@ if(Ruby_EXECUTABLE AND NOT Ruby_VERSION_MAJOR)
set(Ruby_VERSION_MAJOR 2)
set(Ruby_VERSION_MINOR 7)
endif()
+ # check whether we found 3.0.x
+ if(${Ruby_EXECUTABLE} MATCHES "ruby3\\.?0")
+ set(Ruby_VERSION_MAJOR 3)
+ set(Ruby_VERSION_MINOR 0)
+ endif()
+ # check whether we found 3.1.x
+ if(${Ruby_EXECUTABLE} MATCHES "ruby3\\.?1")
+ set(Ruby_VERSION_MAJOR 3)
+ set(Ruby_VERSION_MINOR 1)
+ endif()
endif()
if(Ruby_VERSION_MAJOR)