summaryrefslogtreecommitdiff
path: root/Modules/FindRuby.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-03-13 14:13:17 -0400
committerBrad King <brad.king@kitware.com>2020-03-13 14:13:17 -0400
commitffa08d256fa0aaa52afcb05b50f4d4a485d84171 (patch)
tree248296ac6254680bf295400343bde8ca047fba41 /Modules/FindRuby.cmake
parent50c97e1da075e23d4dcdd74110f1a69c5f572a34 (diff)
downloadcmake-ffa08d256fa0aaa52afcb05b50f4d4a485d84171.tar.gz
FindRuby: Fix compatibility with upper-case cache variables
In commit e672db628b (FindRuby: Rename variables to match case of module name, 2020-03-11) compatibility was provided for result variables but not for the cache entries that scripts might set.
Diffstat (limited to 'Modules/FindRuby.cmake')
-rw-r--r--Modules/FindRuby.cmake16
1 files changed, 16 insertions, 0 deletions
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index 87637bed80..5df242bb67 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -34,6 +34,22 @@ Also:
same as Ruby_INCLUDE_DIRS, only provided for compatibility reasons, don't use it
#]=======================================================================]
+# Backwards compatibility
+# Define camel case versions of input variables
+foreach(UPPER
+ RUBY_EXECUTABLE
+ RUBY_LIBRARY
+ RUBY_INCLUDE_DIR
+ RUBY_CONFIG_INCLUDE_DIR
+ )
+ if (DEFINED ${UPPER})
+ string(REPLACE "RUBY_" "Ruby_" Camel ${UPPER})
+ if (NOT DEFINED ${Camel})
+ set(${Camel} ${${UPPER}})
+ endif()
+ endif()
+endforeach()
+
# Ruby_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'`
# Ruby_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'`
# Ruby_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'`