# FindRuby

Find Ruby

This module finds if Ruby is installed and determines where the include files and libraries are. Ruby 1.8 through 3.3 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_FOUND`

  set to true if ruby was found successfully

`Ruby_EXECUTABLE`

  full path to the ruby binary

`Ruby_INCLUDE_DIRS`

  include dirs to be used when using the ruby library

`Ruby_LIBRARIES`

  Added in version 3.18: libraries needed to use ruby from C.

`Ruby_VERSION`

  the version of ruby which was found, e.g. "1.8.7"

`Ruby_VERSION_MAJOR`

  Ruby major version.

`Ruby_VERSION_MINOR`

  Ruby minor version.

`Ruby_VERSION_PATCH`

  Ruby 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_EXECUTABLE`

  same as Ruby_EXECUTABLE.

`RUBY_INCLUDE_DIRS`

  same as Ruby_INCLUDE_DIRS.

`RUBY_INCLUDE_PATH`

  same as Ruby_INCLUDE_DIRS.

`RUBY_LIBRARY`

  same as Ruby_LIBRARY.

`RUBY_VERSION`

  same as Ruby_VERSION.

`RUBY_FOUND`

  same as Ruby_FOUND.

## Hints

Added in version 3.18.

`Ruby_FIND_VIRTUALENV`

  This variable defines the handling of virtual environments managed by `rvm`. It is meaningful only when a virtual environment is active (i.e. the `rvm` script has been evaluated or at least the `MY_RUBY_HOME` environment variable is set). The `Ruby_FIND_VIRTUALENV` variable 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...)