FindGSL — CMake 4.2.6 Documentation

# FindGSL

Added in version 3.2.

Finds the native GNU Scientific Library (GSL) includes and libraries:

    find_package(GSL [<version>] [...])

The GNU Scientific Library (GSL) is a numerical library for C and C++ programmers. It is free software under the GNU General Public License.

## Imported Targets

This module provides the following Imported Targets:

`GSL::gsl`

  Target encapsulating the main GSL library and all usage requirements, available only if GSL is found.

`GSL::gslcblas`

  Target encapsulating the usage requirements of the CBLAS support library used by GSL. This target is available if GSL is found. It is linked also into the `GSL::gsl` target but provided separately for granularity.

## Result Variables

This module defines the following variables:

`GSL_FOUND`

  Boolean indicating whether (the requested version of) GSL was found on the local system.

`GSL_VERSION`

  The version of the discovered GSL installation.

`GSL_INCLUDE_DIRS`

  Directory containing GSL header files.

`GSL_LIBRARIES`

  The GSL libraries.

## Cache Variables

This module may set the following variables depending on platform and type of GSL installation discovered. These variables may optionally be set to help this module find the correct files:

`GSL_CBLAS_LIBRARY`

  Location of the GSL CBLAS library.

`GSL_CBLAS_LIBRARY_DEBUG`

  Location of the debug GSL CBLAS library (if any).

`GSL_CONFIG_EXECUTABLE`

  Location of the `gsl-config` script (if any).

`GSL_LIBRARY`

  Location of the GSL library.

`GSL_LIBRARY_DEBUG`

  Location of the debug GSL library (if any).

## Hints

This module accepts the following variables:

`GSL_ROOT_DIR`

  Set this variable to a directory that contains a GSL installation.

  If this variable is not set, this module will use pkg-config and default paths to find GSL. If this variable is provided, then this module expects to find libraries at `${GSL_ROOT_DIR}/lib` and the GSL headers at `${GSL_ROOT_DIR}/include/gsl`.

  The library directory may optionally provide Release and Debug folders. If available, the libraries named `gsld`, `gslblasd` or `cblasd` are recognized as debug libraries. For Unix-like systems, this module will also use `gsl-config` (if found) to aid in the discovery of GSL.

## Examples

Finding GSL and linking it to a project target:

    find_package(GSL)
    target_link_libraries(project_target PRIVATE GSL::gsl)