FindRuby¶
Find Ruby
This module finds if Ruby is installed and determines where the include files and libraries are. Ruby 1.8 through 2.7 are supported.
The minimum required version of Ruby can be specified using the standard syntax, e.g.
find_package(Ruby 2.5.1 EXACT REQUIRED)
# OR
find_package(Ruby 2.4)
It also determines what the name of the library is.
Virtual environments such as RVM are handled as well, by passing
the argument Ruby_FIND_VIRTUALENV
Result Variables¶
This module will set the following variables in your project:
Ruby_FOUNDset to true if ruby was found successfully
Ruby_EXECUTABLEfull path to the ruby binary
Ruby_INCLUDE_DIRSinclude dirs to be used when using the ruby library
Ruby_LIBRARIESNew in version 3.18: libraries needed to use ruby from C.
Ruby_VERSIONthe version of ruby which was found, e.g. "1.8.7"
Ruby_VERSION_MAJORRuby major version.
Ruby_VERSION_MINORRuby minor version.
Ruby_VERSION_PATCHRuby patch version.
Changed in version 3.18: Previous versions of CMake used the RUBY_ prefix for all variables.
The following variables are provided for compatibility reasons,
don't use them in new code:
RUBY_EXECUTABLEsame as Ruby_EXECUTABLE.
RUBY_INCLUDE_DIRSsame as Ruby_INCLUDE_DIRS.
RUBY_INCLUDE_PATHsame as Ruby_INCLUDE_DIRS.
RUBY_LIBRARYsame as Ruby_LIBRARY.
RUBY_VERSIONsame as Ruby_VERSION.
RUBY_FOUNDsame as Ruby_FOUND.
Hints¶
New in version 3.18.
Ruby_ROOT_DIRDefine the root directory of a Ruby installation.
Ruby_FIND_VIRTUALENVThis variable defines the handling of virtual environments managed by
rvm. It is meaningful only when a virtual environment is active (i.e. thervmscript has been evaluated or at least theMY_RUBY_HOMEenvironment variable is set). TheRuby_FIND_VIRTUALENVvariable can be set to empty or one of the following:FIRST: The virtual environment is used before any other standard paths to look-up for the interpreter. This is the default.ONLY: Only the virtual environment is used to look-up for the interpreter.STANDARD: The virtual environment is not used to look-up for the interpreter (assuming it isn't still in the PATH...)