mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
FindRuby: evict non-matching binaries and keep scanning.
The possible executable names list always starts with a plain "ruby" binary, which is scanned for first. If that does exist (which satisfies find_program), but doesn't match the requested version, the executable will be dismissed by _RUBY_VALIDATE_INTERPRETER (which is sane), but searching also stops. Fix that by keeping the search going, removing items from the list as we go, until find_program returns a path that _RUBY_VALIDATE_INTERPRETER is happy with or the list is empty.
This commit is contained in:
@@ -266,9 +266,20 @@ while(1)
|
||||
_RUBY_VALIDATE_INTERPRETER (${Ruby_FIND_VERSION})
|
||||
if (Ruby_EXECUTABLE)
|
||||
break()
|
||||
else()
|
||||
# Remove first entry from names list.
|
||||
LIST(REMOVE_AT _Ruby_POSSIBLE_EXECUTABLE_NAMES 0)
|
||||
|
||||
# If the list is now empty, abort.
|
||||
if (NOT _Ruby_POSSIBLE_EXECUTABLE_NAMES)
|
||||
break()
|
||||
else()
|
||||
# Otherwise, continue with the remaining list. Make sure that we clear
|
||||
# the cached variable.
|
||||
unset(Ruby_EXECUTABLE CACHE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
break()
|
||||
endwhile()
|
||||
|
||||
if(Ruby_EXECUTABLE AND NOT Ruby_VERSION_MAJOR)
|
||||
|
||||
Reference in New Issue
Block a user