FindOpenCL

Added in version 3.1.

Finds Open Computing Language (OpenCL).

Added in version 3.10: Detection of OpenCL 2.1 and 2.2.

Imported Targets

Added in version 3.7.

This module provides the following Imported Targets, if OpenCL has been found:

OpenCL::OpenCL

Target providing OpenCL usage requirements.

Result Variables

This module defines the following variables:

OpenCL_FOUND

True if OpenCL was found.

OpenCL_INCLUDE_DIRS

Include directories needed to use OpenCL.

OpenCL_LIBRARIES

Libraries needed to link to OpenCL.

OpenCL_VERSION_STRING

Highest supported OpenCL version (e.g., 1.2).

OpenCL_VERSION_MAJOR

The major version of the OpenCL implementation.

OpenCL_VERSION_MINOR

The minor version of the OpenCL implementation.

Cache Variables

The following cache variables may also be set:

OpenCL_INCLUDE_DIR

The OpenCL include directory.

OpenCL_LIBRARY

The path to the OpenCL library.

Examples

Finding OpenCL and linking it to a project target:

find_package(OpenCL)
target_link_libraries(project_target PRIVATE OpenCL::OpenCL)