Tests/FindRuby/Rvm: Honor Ruby_FIND_VIRTUALENV ONLY

This commit is contained in:
cfis
2024-12-06 16:12:16 -08:00
committed by Brad King
parent a023377b86
commit f06b2af291

View File

@@ -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()