From f06b2af29168f0363543f4b5b57ccfa672f71ba8 Mon Sep 17 00:00:00 2001 From: cfis Date: Fri, 6 Dec 2024 16:12:16 -0800 Subject: [PATCH] Tests/FindRuby/Rvm: Honor Ruby_FIND_VIRTUALENV ONLY --- Tests/FindRuby/Rvm/RvmOnly.cmake | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Tests/FindRuby/Rvm/RvmOnly.cmake b/Tests/FindRuby/Rvm/RvmOnly.cmake index 3851a7ccd4..86b32db250 100644 --- a/Tests/FindRuby/Rvm/RvmOnly.cmake +++ b/Tests/FindRuby/Rvm/RvmOnly.cmake @@ -21,21 +21,17 @@ endif() # Test: FindRuby.UnsetRvmOnly if (NOT RUBY_HOME) - # If ENV{MY_RUBY_HOME} isn't defined, it should default back to "STANDARD" - # At which point: + # If ENV{MY_RUBY_HOME} isn't defined and Ruby_FIND_VIRTUALENV is set to ONLY + # then Ruby should not be found - # It shouldn't find the RVM ruby find_package (Ruby ${RVM_RUBY_VERSION} EXACT QUIET) if(Ruby_FOUND) - message(FATAL_ERROR "Found RVM ruby when expecting system") + message (FATAL_ERROR "RVM Ruby unexpectedly found.") endif() - # it should find the system ruby + # it should *not* find the system ruby find_package (Ruby ${SYSTEM_RUBY_VERSION} EXACT QUIET) - if(NOT Ruby_FOUND) - message (FATAL_ERROR "Ruby not found.") - endif() - if (Ruby_FOUND MATCHES "^${RUBY_HOME}/.+") - message(FATAL_ERROR "Failed to find system ruby") + if(Ruby_FOUND) + message (FATAL_ERROR "Ruby unexpectedly found.") endif() endif()