summaryrefslogtreecommitdiffstats
path: root/Modules/FindRuby.cmake
diff options
context:
space:
mode:
authorJulien Marrec <julien.marrec@gmail.com>2020-03-11 17:25:28 (GMT)
committerBrad King <brad.king@kitware.com>2020-03-11 17:56:10 (GMT)
commite672db628b0785a1e3af85d2af68ad82316f303e (patch)
tree557a8e58ac8e25b56bee7631a155f4b2aefd7abd /Modules/FindRuby.cmake
parentc7c6e103d1209f7e29cb2909cf342be75478f304 (diff)
downloadCMake-e672db628b0785a1e3af85d2af68ad82316f303e.zip
CMake-e672db628b0785a1e3af85d2af68ad82316f303e.tar.gz
CMake-e672db628b0785a1e3af85d2af68ad82316f303e.tar.bz2
FindRuby: Rename variables to match case of module name
Use recommended case for variable names, i.e. matching name of the module as passed to `find_package`. For backwards compatibility, the upper case versions of both input and output variables are used and defined when appropriate. Skip this for the _FOUND variable because FPHSA already does it. This follows the approach from commit a7b09e7f43 (FindProtobuf: Rename variables to match case of module name, 2016-03-01, v3.6.0-rc1~273^2). Issue: #20370
Diffstat (limited to 'Modules/FindRuby.cmake')
-rw-r--r--Modules/FindRuby.cmake342
1 files changed, 185 insertions, 157 deletions
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index 7e01fbc..6918aed 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -17,279 +17,307 @@ standard syntax, e.g. find_package(Ruby 1.8)
It also determines what the name of the library is. This code sets
the following variables:
-``RUBY_EXECUTABLE``
+``Ruby_EXECUTABLE``
full path to the ruby binary
-``RUBY_INCLUDE_DIRS``
+``Ruby_INCLUDE_DIRS``
include dirs to be used when using the ruby library
-``RUBY_LIBRARY``
+``Ruby_LIBARY``
full path to the ruby library
-``RUBY_VERSION``
+``Ruby_VERSION``
the version of ruby which was found, e.g. "1.8.7"
-``RUBY_FOUND``
+``Ruby_FOUND``
set to true if ruby ws found successfully
Also:
-``RUBY_INCLUDE_PATH``
- same as RUBY_INCLUDE_DIRS, only provided for compatibility reasons, don't use it
+``Ruby_INCLUDE_PATH``
+ same as Ruby_INCLUDE_DIRS, only provided for compatibility reasons, don't use it
#]=======================================================================]
-# 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"@:>@)'`
-# RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'`
-# RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
+# 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"@:>@)'`
+# Ruby_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'`
+# Ruby_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'`
# uncomment the following line to get debug output for this file
-# set(_RUBY_DEBUG_OUTPUT TRUE)
+# set(_Ruby_DEBUG_OUTPUT TRUE)
# Determine the list of possible names of the ruby executable depending
# on which version of ruby is required
-set(_RUBY_POSSIBLE_EXECUTABLE_NAMES ruby)
+set(_Ruby_POSSIBLE_EXECUTABLE_NAMES ruby)
# if 1.9 is required, don't look for ruby18 and ruby1.8, default to version 1.8
if(DEFINED Ruby_FIND_VERSION_MAJOR AND DEFINED Ruby_FIND_VERSION_MINOR)
- set(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${RUBY_FIND_VERSION_MINOR}")
+ set(Ruby_FIND_VERSION_SHORT_NODOT "${Ruby_FIND_VERSION_MAJOR}${Ruby_FIND_VERSION_MINOR}")
# we can't construct that if only major version is given
- set(_RUBY_POSSIBLE_EXECUTABLE_NAMES
+ set(_Ruby_POSSIBLE_EXECUTABLE_NAMES
ruby${Ruby_FIND_VERSION_MAJOR}.${Ruby_FIND_VERSION_MINOR}
ruby${Ruby_FIND_VERSION_MAJOR}${Ruby_FIND_VERSION_MINOR}
- ${_RUBY_POSSIBLE_EXECUTABLE_NAMES})
+ ${_Ruby_POSSIBLE_EXECUTABLE_NAMES})
else()
set(Ruby_FIND_VERSION_SHORT_NODOT "18")
endif()
if(NOT Ruby_FIND_VERSION_EXACT)
- list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.4 ruby24)
- list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.3 ruby23)
- list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.2 ruby22)
- list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.1 ruby21)
- list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby2.0 ruby20)
- list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby1.9 ruby19)
+ list(APPEND _Ruby_POSSIBLE_EXECUTABLE_NAMES ruby2.4 ruby24)
+ list(APPEND _Ruby_POSSIBLE_EXECUTABLE_NAMES ruby2.3 ruby23)
+ list(APPEND _Ruby_POSSIBLE_EXECUTABLE_NAMES ruby2.2 ruby22)
+ list(APPEND _Ruby_POSSIBLE_EXECUTABLE_NAMES ruby2.1 ruby21)
+ list(APPEND _Ruby_POSSIBLE_EXECUTABLE_NAMES ruby2.0 ruby20)
+ list(APPEND _Ruby_POSSIBLE_EXECUTABLE_NAMES ruby1.9 ruby19)
# if we want a version below 1.9, also look for ruby 1.8
if("${Ruby_FIND_VERSION_SHORT_NODOT}" VERSION_LESS "19")
- list(APPEND _RUBY_POSSIBLE_EXECUTABLE_NAMES ruby1.8 ruby18)
+ list(APPEND _Ruby_POSSIBLE_EXECUTABLE_NAMES ruby1.8 ruby18)
endif()
- list(REMOVE_DUPLICATES _RUBY_POSSIBLE_EXECUTABLE_NAMES)
+ list(REMOVE_DUPLICATES _Ruby_POSSIBLE_EXECUTABLE_NAMES)
endif()
-find_program(RUBY_EXECUTABLE NAMES ${_RUBY_POSSIBLE_EXECUTABLE_NAMES})
+find_program(Ruby_EXECUTABLE NAMES ${_Ruby_POSSIBLE_EXECUTABLE_NAMES})
-if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
+if(Ruby_EXECUTABLE AND NOT Ruby_VERSION_MAJOR)
function(_RUBY_CONFIG_VAR RBVAR OUTVAR)
- execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['${RBVAR}']"
- RESULT_VARIABLE _RUBY_SUCCESS
- OUTPUT_VARIABLE _RUBY_OUTPUT
+ execute_process(COMMAND ${Ruby_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['${RBVAR}']"
+ RESULT_VARIABLE _Ruby_SUCCESS
+ OUTPUT_VARIABLE _Ruby_OUTPUT
ERROR_QUIET)
- if(_RUBY_SUCCESS OR _RUBY_OUTPUT STREQUAL "")
- execute_process(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']"
- RESULT_VARIABLE _RUBY_SUCCESS
- OUTPUT_VARIABLE _RUBY_OUTPUT
+ if(_Ruby_SUCCESS OR _Ruby_OUTPUT STREQUAL "")
+ execute_process(COMMAND ${Ruby_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['${RBVAR}']"
+ RESULT_VARIABLE _Ruby_SUCCESS
+ OUTPUT_VARIABLE _Ruby_OUTPUT
ERROR_QUIET)
endif()
- set(${OUTVAR} "${_RUBY_OUTPUT}" PARENT_SCOPE)
+ set(${OUTVAR} "${_Ruby_OUTPUT}" PARENT_SCOPE)
endfunction()
# query the ruby version
- _RUBY_CONFIG_VAR("MAJOR" RUBY_VERSION_MAJOR)
- _RUBY_CONFIG_VAR("MINOR" RUBY_VERSION_MINOR)
- _RUBY_CONFIG_VAR("TEENY" RUBY_VERSION_PATCH)
+ _RUBY_CONFIG_VAR("MAJOR" Ruby_VERSION_MAJOR)
+ _RUBY_CONFIG_VAR("MINOR" Ruby_VERSION_MINOR)
+ _RUBY_CONFIG_VAR("TEENY" Ruby_VERSION_PATCH)
# query the different directories
- _RUBY_CONFIG_VAR("archdir" RUBY_ARCH_DIR)
- _RUBY_CONFIG_VAR("arch" RUBY_ARCH)
- _RUBY_CONFIG_VAR("rubyhdrdir" RUBY_HDR_DIR)
- _RUBY_CONFIG_VAR("rubyarchhdrdir" RUBY_ARCHHDR_DIR)
- _RUBY_CONFIG_VAR("libdir" RUBY_POSSIBLE_LIB_DIR)
- _RUBY_CONFIG_VAR("rubylibdir" RUBY_RUBY_LIB_DIR)
+ _RUBY_CONFIG_VAR("archdir" Ruby_ARCH_DIR)
+ _RUBY_CONFIG_VAR("arch" Ruby_ARCH)
+ _RUBY_CONFIG_VAR("rubyhdrdir" Ruby_HDR_DIR)
+ _RUBY_CONFIG_VAR("rubyarchhdrdir" Ruby_ARCHHDR_DIR)
+ _RUBY_CONFIG_VAR("libdir" Ruby_POSSIBLE_LIB_DIR)
+ _RUBY_CONFIG_VAR("rubylibdir" Ruby_RUBY_LIB_DIR)
# site_ruby
- _RUBY_CONFIG_VAR("sitearchdir" RUBY_SITEARCH_DIR)
- _RUBY_CONFIG_VAR("sitelibdir" RUBY_SITELIB_DIR)
+ _RUBY_CONFIG_VAR("sitearchdir" Ruby_SITEARCH_DIR)
+ _RUBY_CONFIG_VAR("sitelibdir" Ruby_SITELIB_DIR)
# vendor_ruby available ?
- execute_process(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'"
- OUTPUT_VARIABLE RUBY_HAS_VENDOR_RUBY ERROR_QUIET)
+ execute_process(COMMAND ${Ruby_EXECUTABLE} -r vendor-specific -e "print 'true'"
+ OUTPUT_VARIABLE Ruby_HAS_VENDOR_RUBY ERROR_QUIET)
- if(RUBY_HAS_VENDOR_RUBY)
- _RUBY_CONFIG_VAR("vendorlibdir" RUBY_VENDORLIB_DIR)
- _RUBY_CONFIG_VAR("vendorarchdir" RUBY_VENDORARCH_DIR)
+ if(Ruby_HAS_VENDOR_RUBY)
+ _RUBY_CONFIG_VAR("vendorlibdir" Ruby_VENDORLIB_DIR)
+ _RUBY_CONFIG_VAR("vendorarchdir" Ruby_VENDORARCH_DIR)
endif()
# save the results in the cache so we don't have to run ruby the next time again
- set(RUBY_VERSION_MAJOR ${RUBY_VERSION_MAJOR} CACHE PATH "The Ruby major version" FORCE)
- set(RUBY_VERSION_MINOR ${RUBY_VERSION_MINOR} CACHE PATH "The Ruby minor version" FORCE)
- set(RUBY_VERSION_PATCH ${RUBY_VERSION_PATCH} CACHE PATH "The Ruby patch version" FORCE)
- set(RUBY_ARCH_DIR ${RUBY_ARCH_DIR} CACHE PATH "The Ruby arch dir" FORCE)
- set(RUBY_HDR_DIR ${RUBY_HDR_DIR} CACHE PATH "The Ruby header dir (1.9+)" FORCE)
- set(RUBY_ARCHHDR_DIR ${RUBY_ARCHHDR_DIR} CACHE PATH "The Ruby arch header dir (2.0+)" FORCE)
- set(RUBY_POSSIBLE_LIB_DIR ${RUBY_POSSIBLE_LIB_DIR} CACHE PATH "The Ruby lib dir" FORCE)
- set(RUBY_RUBY_LIB_DIR ${RUBY_RUBY_LIB_DIR} CACHE PATH "The Ruby ruby-lib dir" FORCE)
- set(RUBY_SITEARCH_DIR ${RUBY_SITEARCH_DIR} CACHE PATH "The Ruby site arch dir" FORCE)
- set(RUBY_SITELIB_DIR ${RUBY_SITELIB_DIR} CACHE PATH "The Ruby site lib dir" FORCE)
- set(RUBY_HAS_VENDOR_RUBY ${RUBY_HAS_VENDOR_RUBY} CACHE BOOL "Vendor Ruby is available" FORCE)
- set(RUBY_VENDORARCH_DIR ${RUBY_VENDORARCH_DIR} CACHE PATH "The Ruby vendor arch dir" FORCE)
- set(RUBY_VENDORLIB_DIR ${RUBY_VENDORLIB_DIR} CACHE PATH "The Ruby vendor lib dir" FORCE)
+ set(Ruby_VERSION_MAJOR ${Ruby_VERSION_MAJOR} CACHE PATH "The Ruby major version" FORCE)
+ set(Ruby_VERSION_MINOR ${Ruby_VERSION_MINOR} CACHE PATH "The Ruby minor version" FORCE)
+ set(Ruby_VERSION_PATCH ${Ruby_VERSION_PATCH} CACHE PATH "The Ruby patch version" FORCE)
+ set(Ruby_ARCH_DIR ${Ruby_ARCH_DIR} CACHE PATH "The Ruby arch dir" FORCE)
+ set(Ruby_HDR_DIR ${Ruby_HDR_DIR} CACHE PATH "The Ruby header dir (1.9+)" FORCE)
+ set(Ruby_ARCHHDR_DIR ${Ruby_ARCHHDR_DIR} CACHE PATH "The Ruby arch header dir (2.0+)" FORCE)
+ set(Ruby_POSSIBLE_LIB_DIR ${Ruby_POSSIBLE_LIB_DIR} CACHE PATH "The Ruby lib dir" FORCE)
+ set(Ruby_RUBY_LIB_DIR ${Ruby_RUBY_LIB_DIR} CACHE PATH "The Ruby ruby-lib dir" FORCE)
+ set(Ruby_SITEARCH_DIR ${Ruby_SITEARCH_DIR} CACHE PATH "The Ruby site arch dir" FORCE)
+ set(Ruby_SITELIB_DIR ${Ruby_SITELIB_DIR} CACHE PATH "The Ruby site lib dir" FORCE)
+ set(Ruby_HAS_VENDOR_RUBY ${Ruby_HAS_VENDOR_RUBY} CACHE BOOL "Vendor Ruby is available" FORCE)
+ set(Ruby_VENDORARCH_DIR ${Ruby_VENDORARCH_DIR} CACHE PATH "The Ruby vendor arch dir" FORCE)
+ set(Ruby_VENDORLIB_DIR ${Ruby_VENDORLIB_DIR} CACHE PATH "The Ruby vendor lib dir" FORCE)
mark_as_advanced(
- RUBY_ARCH_DIR
- RUBY_ARCH
- RUBY_HDR_DIR
- RUBY_ARCHHDR_DIR
- RUBY_POSSIBLE_LIB_DIR
- RUBY_RUBY_LIB_DIR
- RUBY_SITEARCH_DIR
- RUBY_SITELIB_DIR
- RUBY_HAS_VENDOR_RUBY
- RUBY_VENDORARCH_DIR
- RUBY_VENDORLIB_DIR
- RUBY_VERSION_MAJOR
- RUBY_VERSION_MINOR
- RUBY_VERSION_PATCH
+ Ruby_ARCH_DIR
+ Ruby_ARCH
+ Ruby_HDR_DIR
+ Ruby_ARCHHDR_DIR
+ Ruby_POSSIBLE_LIB_DIR
+ Ruby_RUBY_LIB_DIR
+ Ruby_SITEARCH_DIR
+ Ruby_SITELIB_DIR
+ Ruby_HAS_VENDOR_RUBY
+ Ruby_VENDORARCH_DIR
+ Ruby_VENDORLIB_DIR
+ Ruby_VERSION_MAJOR
+ Ruby_VERSION_MINOR
+ Ruby_VERSION_PATCH
)
endif()
-# In case RUBY_EXECUTABLE could not be executed (e.g. cross compiling)
+# In case Ruby_EXECUTABLE could not be executed (e.g. cross compiling)
# try to detect which version we found. This is not too good.
-if(RUBY_EXECUTABLE AND NOT RUBY_VERSION_MAJOR)
+if(Ruby_EXECUTABLE AND NOT Ruby_VERSION_MAJOR)
# by default assume 1.8.0
- set(RUBY_VERSION_MAJOR 1)
- set(RUBY_VERSION_MINOR 8)
- set(RUBY_VERSION_PATCH 0)
+ set(Ruby_VERSION_MAJOR 1)
+ set(Ruby_VERSION_MINOR 8)
+ set(Ruby_VERSION_PATCH 0)
# check whether we found 1.9.x
- if(${RUBY_EXECUTABLE} MATCHES "ruby1\\.?9")
- set(RUBY_VERSION_MAJOR 1)
- set(RUBY_VERSION_MINOR 9)
+ if(${Ruby_EXECUTABLE} MATCHES "ruby1\\.?9")
+ set(Ruby_VERSION_MAJOR 1)
+ set(Ruby_VERSION_MINOR 9)
endif()
# check whether we found 2.0.x
- if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?0")
- set(RUBY_VERSION_MAJOR 2)
- set(RUBY_VERSION_MINOR 0)
+ if(${Ruby_EXECUTABLE} MATCHES "ruby2\\.?0")
+ set(Ruby_VERSION_MAJOR 2)
+ set(Ruby_VERSION_MINOR 0)
endif()
# check whether we found 2.1.x
- if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?1")
- set(RUBY_VERSION_MAJOR 2)
- set(RUBY_VERSION_MINOR 1)
+ if(${Ruby_EXECUTABLE} MATCHES "ruby2\\.?1")
+ set(Ruby_VERSION_MAJOR 2)
+ set(Ruby_VERSION_MINOR 1)
endif()
# check whether we found 2.2.x
- if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?2")
- set(RUBY_VERSION_MAJOR 2)
- set(RUBY_VERSION_MINOR 2)
+ if(${Ruby_EXECUTABLE} MATCHES "ruby2\\.?2")
+ set(Ruby_VERSION_MAJOR 2)
+ set(Ruby_VERSION_MINOR 2)
endif()
# check whether we found 2.3.x
- if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?3")
- set(RUBY_VERSION_MAJOR 2)
- set(RUBY_VERSION_MINOR 3)
+ if(${Ruby_EXECUTABLE} MATCHES "ruby2\\.?3")
+ set(Ruby_VERSION_MAJOR 2)
+ set(Ruby_VERSION_MINOR 3)
endif()
# check whether we found 2.4.x
- if(${RUBY_EXECUTABLE} MATCHES "ruby2\\.?4")
- set(RUBY_VERSION_MAJOR 2)
- set(RUBY_VERSION_MINOR 4)
+ if(${Ruby_EXECUTABLE} MATCHES "ruby2\\.?4")
+ set(Ruby_VERSION_MAJOR 2)
+ set(Ruby_VERSION_MINOR 4)
endif()
endif()
-if(RUBY_VERSION_MAJOR)
- set(RUBY_VERSION "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}.${RUBY_VERSION_PATCH}")
- set(_RUBY_VERSION_SHORT "${RUBY_VERSION_MAJOR}.${RUBY_VERSION_MINOR}")
- set(_RUBY_VERSION_SHORT_NODOT "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}")
- set(_RUBY_NODOT_VERSION "${RUBY_VERSION_MAJOR}${RUBY_VERSION_MINOR}${RUBY_VERSION_PATCH}")
+if(Ruby_VERSION_MAJOR)
+ set(Ruby_VERSION "${Ruby_VERSION_MAJOR}.${Ruby_VERSION_MINOR}.${Ruby_VERSION_PATCH}")
+ set(_Ruby_VERSION_SHORT "${Ruby_VERSION_MAJOR}.${Ruby_VERSION_MINOR}")
+ set(_Ruby_VERSION_SHORT_NODOT "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}")
+ set(_Ruby_NODOT_VERSION "${Ruby_VERSION_MAJOR}${Ruby_VERSION_MINOR}${Ruby_VERSION_PATCH}")
endif()
-find_path(RUBY_INCLUDE_DIR
+find_path(Ruby_INCLUDE_DIR
NAMES ruby.h
HINTS
- ${RUBY_HDR_DIR}
- ${RUBY_ARCH_DIR}
- /usr/lib/ruby/${_RUBY_VERSION_SHORT}/i586-linux-gnu/
+ ${Ruby_HDR_DIR}
+ ${Ruby_ARCH_DIR}
+ /usr/lib/ruby/${_Ruby_VERSION_SHORT}/i586-linux-gnu/
)
-set(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIR} )
+set(Ruby_INCLUDE_DIRS ${Ruby_INCLUDE_DIR} )
# if ruby > 1.8 is required or if ruby > 1.8 was found, search for the config.h dir
-if( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_RUBY_VERSION_SHORT_NODOT}" GREATER 18 OR RUBY_HDR_DIR)
- find_path(RUBY_CONFIG_INCLUDE_DIR
+if( "${Ruby_FIND_VERSION_SHORT_NODOT}" GREATER 18 OR "${_Ruby_VERSION_SHORT_NODOT}" GREATER 18 OR Ruby_HDR_DIR)
+ find_path(Ruby_CONFIG_INCLUDE_DIR
NAMES ruby/config.h config.h
HINTS
- ${RUBY_HDR_DIR}/${RUBY_ARCH}
- ${RUBY_ARCH_DIR}
- ${RUBY_ARCHHDR_DIR}
+ ${Ruby_HDR_DIR}/${Ruby_ARCH}
+ ${Ruby_ARCH_DIR}
+ ${Ruby_ARCHHDR_DIR}
)
- set(RUBY_INCLUDE_DIRS ${RUBY_INCLUDE_DIRS} ${RUBY_CONFIG_INCLUDE_DIR} )
+ set(Ruby_INCLUDE_DIRS ${Ruby_INCLUDE_DIRS} ${Ruby_CONFIG_INCLUDE_DIR} )
endif()
# Determine the list of possible names for the ruby library
-set(_RUBY_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_RUBY_VERSION_SHORT} ruby${_RUBY_VERSION_SHORT_NODOT} ruby-${_RUBY_VERSION_SHORT} ruby-${RUBY_VERSION})
+set(_Ruby_POSSIBLE_LIB_NAMES ruby ruby-static ruby${_Ruby_VERSION_SHORT} ruby${_Ruby_VERSION_SHORT_NODOT} ruby-${_Ruby_VERSION_SHORT} ruby-${Ruby_VERSION})
if(WIN32)
- set( _RUBY_MSVC_RUNTIME "" )
+ set( _Ruby_MSVC_RUNTIME "" )
if( MSVC_VERSION EQUAL 1200 )
- set( _RUBY_MSVC_RUNTIME "60" )
+ set( _Ruby_MSVC_RUNTIME "60" )
endif()
if( MSVC_VERSION EQUAL 1300 )
- set( _RUBY_MSVC_RUNTIME "70" )
+ set( _Ruby_MSVC_RUNTIME "70" )
endif()
if( MSVC_VERSION EQUAL 1310 )
- set( _RUBY_MSVC_RUNTIME "71" )
+ set( _Ruby_MSVC_RUNTIME "71" )
endif()
if( MSVC_VERSION EQUAL 1400 )
- set( _RUBY_MSVC_RUNTIME "80" )
+ set( _Ruby_MSVC_RUNTIME "80" )
endif()
if( MSVC_VERSION EQUAL 1500 )
- set( _RUBY_MSVC_RUNTIME "90" )
+ set( _Ruby_MSVC_RUNTIME "90" )
endif()
- set(_RUBY_ARCH_PREFIX "")
+ set(_Ruby_ARCH_PREFIX "")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
- set(_RUBY_ARCH_PREFIX "x64-")
+ set(_Ruby_ARCH_PREFIX "x64-")
endif()
- list(APPEND _RUBY_POSSIBLE_LIB_NAMES
- "${_RUBY_ARCH_PREFIX}msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}"
- "${_RUBY_ARCH_PREFIX}msvcr${_RUBY_MSVC_RUNTIME}-ruby${_RUBY_NODOT_VERSION}-static"
- "${_RUBY_ARCH_PREFIX}msvcrt-ruby${_RUBY_NODOT_VERSION}"
- "${_RUBY_ARCH_PREFIX}msvcrt-ruby${_RUBY_NODOT_VERSION}-static" )
+ list(APPEND _Ruby_POSSIBLE_LIB_NAMES
+ "${_Ruby_ARCH_PREFIX}msvcr${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_NODOT_VERSION}"
+ "${_Ruby_ARCH_PREFIX}msvcr${_Ruby_MSVC_RUNTIME}-ruby${_Ruby_NODOT_VERSION}-static"
+ "${_Ruby_ARCH_PREFIX}msvcrt-ruby${_Ruby_NODOT_VERSION}"
+ "${_Ruby_ARCH_PREFIX}msvcrt-ruby${_Ruby_NODOT_VERSION}-static" )
endif()
-find_library(RUBY_LIBRARY NAMES ${_RUBY_POSSIBLE_LIB_NAMES} HINTS ${RUBY_POSSIBLE_LIB_DIR} )
+find_library(Ruby_LIBARY NAMES ${_Ruby_POSSIBLE_LIB_NAMES} HINTS ${Ruby_POSSIBLE_LIB_DIR} )
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-set(_RUBY_REQUIRED_VARS RUBY_EXECUTABLE RUBY_INCLUDE_DIR RUBY_LIBRARY)
-if(_RUBY_VERSION_SHORT_NODOT GREATER 18)
- list(APPEND _RUBY_REQUIRED_VARS RUBY_CONFIG_INCLUDE_DIR)
+set(_Ruby_REQUIRED_VARS Ruby_EXECUTABLE Ruby_INCLUDE_DIR Ruby_LIBARY)
+if(_Ruby_VERSION_SHORT_NODOT GREATER 18)
+ list(APPEND _Ruby_REQUIRED_VARS Ruby_CONFIG_INCLUDE_DIR)
endif()
-if(_RUBY_DEBUG_OUTPUT)
+if(_Ruby_DEBUG_OUTPUT)
message(STATUS "--------FindRuby.cmake debug------------")
- message(STATUS "_RUBY_POSSIBLE_EXECUTABLE_NAMES: ${_RUBY_POSSIBLE_EXECUTABLE_NAMES}")
- message(STATUS "_RUBY_POSSIBLE_LIB_NAMES: ${_RUBY_POSSIBLE_LIB_NAMES}")
- message(STATUS "RUBY_ARCH_DIR: ${RUBY_ARCH_DIR}")
- message(STATUS "RUBY_HDR_DIR: ${RUBY_HDR_DIR}")
- message(STATUS "RUBY_POSSIBLE_LIB_DIR: ${RUBY_POSSIBLE_LIB_DIR}")
- message(STATUS "Found RUBY_VERSION: \"${RUBY_VERSION}\" , short: \"${_RUBY_VERSION_SHORT}\", nodot: \"${_RUBY_VERSION_SHORT_NODOT}\"")
- message(STATUS "_RUBY_REQUIRED_VARS: ${_RUBY_REQUIRED_VARS}")
- message(STATUS "RUBY_EXECUTABLE: ${RUBY_EXECUTABLE}")
- message(STATUS "RUBY_LIBRARY: ${RUBY_LIBRARY}")
- message(STATUS "RUBY_INCLUDE_DIR: ${RUBY_INCLUDE_DIR}")
- message(STATUS "RUBY_CONFIG_INCLUDE_DIR: ${RUBY_CONFIG_INCLUDE_DIR}")
+ message(STATUS "_Ruby_POSSIBLE_EXECUTABLE_NAMES: ${_Ruby_POSSIBLE_EXECUTABLE_NAMES}")
+ message(STATUS "_Ruby_POSSIBLE_LIB_NAMES: ${_Ruby_POSSIBLE_LIB_NAMES}")
+ message(STATUS "Ruby_ARCH_DIR: ${Ruby_ARCH_DIR}")
+ message(STATUS "Ruby_HDR_DIR: ${Ruby_HDR_DIR}")
+ message(STATUS "Ruby_POSSIBLE_LIB_DIR: ${Ruby_POSSIBLE_LIB_DIR}")
+ message(STATUS "Found Ruby_VERSION: \"${Ruby_VERSION}\" , short: \"${_Ruby_VERSION_SHORT}\", nodot: \"${_Ruby_VERSION_SHORT_NODOT}\"")
+ message(STATUS "_Ruby_REQUIRED_VARS: ${_Ruby_REQUIRED_VARS}")
+ message(STATUS "Ruby_EXECUTABLE: ${Ruby_EXECUTABLE}")
+ message(STATUS "Ruby_LIBARY: ${Ruby_LIBARY}")
+ message(STATUS "Ruby_INCLUDE_DIR: ${Ruby_INCLUDE_DIR}")
+ message(STATUS "Ruby_CONFIG_INCLUDE_DIR: ${Ruby_CONFIG_INCLUDE_DIR}")
message(STATUS "--------------------")
endif()
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ruby REQUIRED_VARS ${_RUBY_REQUIRED_VARS}
- VERSION_VAR RUBY_VERSION )
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ruby REQUIRED_VARS ${_Ruby_REQUIRED_VARS}
+ VERSION_VAR Ruby_VERSION )
mark_as_advanced(
- RUBY_EXECUTABLE
- RUBY_LIBRARY
- RUBY_INCLUDE_DIR
- RUBY_CONFIG_INCLUDE_DIR
+ Ruby_EXECUTABLE
+ Ruby_LIBARY
+ Ruby_INCLUDE_DIR
+ Ruby_CONFIG_INCLUDE_DIR
)
-# Set some variables for compatibility with previous version of this file
-set(RUBY_POSSIBLE_LIB_PATH ${RUBY_POSSIBLE_LIB_DIR})
-set(RUBY_RUBY_LIB_PATH ${RUBY_RUBY_LIB_DIR})
-set(RUBY_INCLUDE_PATH ${RUBY_INCLUDE_DIRS})
+# Set some variables for compatibility with previous version of this file (no need to provide a CamelCase version of that...)
+set(RUBY_POSSIBLE_LIB_PATH ${Ruby_POSSIBLE_LIB_DIR})
+set(RUBY_RUBY_LIB_PATH ${Ruby_RUBY_LIB_DIR})
+set(RUBY_INCLUDE_PATH ${Ruby_INCLUDE_DIRS})
+
+# Backwards compatibility
+# Define upper case versions of output variables
+foreach(Camel
+ Ruby_EXECUTABLE
+ Ruby_INCLUDE_DIRS
+ Ruby_LIBRARY
+ Ruby_VERSION
+ Ruby_VERSION_MAJOR
+ Ruby_VERSION_MINOR
+ Ruby_VERSION_PATCH
+ Ruby_INCLUDE_PATH
+
+ Ruby_ARCH_DIR
+ Ruby_ARCH
+ Ruby_HDR_DIR
+ Ruby_ARCHHDR_DIR
+ Ruby_POSSIBLE_LIB_DIR
+ Ruby_RUBY_LIB_DIR
+ Ruby_SITEARCH_DIR
+ Ruby_SITELIB_DIR
+ Ruby_HAS_VENDOR_RUBY
+ Ruby_VENDORARCH_DIR
+
+ )
+ string(TOUPPER ${Camel} UPPER)
+ set(${UPPER} ${${Camel}})
+endforeach()