FindRuby: Fix vendor directory discovery

The `ruby -r vendor-specific` module no longer exists.
Use `ruby -r rbconfig` instead.

This patch has been carried by openSUSE's cmake package:

* https://build.opensuse.org/projects/openSUSE:Factory/packages/cmake/files/cmake-fix-ruby-test.patch?rev=274
* https://build.opensuse.org/package/rdiff/openSUSE:Factory/cmake?rev=106
* https://build.opensuse.org/package/rdiff/openSUSE:Factory/cmake?rev=57
* https://build.opensuse.org/package/rdiff/openSUSE:Factory/cmake?rev=56

Fixes: #27888
This commit is contained in:
Brad King
2026-06-18 10:38:51 -04:00
parent c2fd48014f
commit c4ee728699

View File

@@ -407,7 +407,7 @@ if (Ruby_EXECUTABLE AND NOT Ruby_EXECUTABLE STREQUAL "${_Ruby_EXECUTABLE_LAST_QU
_RUBY_CONFIG_VAR("sitelibdir" Ruby_SITELIB_DIR)
# vendor_ruby - TODO - Not relevant and should be removed.
execute_process(COMMAND "${Ruby_EXECUTABLE}" -r vendor-specific -e "print 'true'"
execute_process(COMMAND ${Ruby_EXECUTABLE} -r rbconfig -e "print 'true' unless RbConfig::CONFIG['vendorarchdir'].nil?"
OUTPUT_VARIABLE Ruby_HAS_VENDOR_RUBY ERROR_QUIET)
if (Ruby_HAS_VENDOR_RUBY)