FindOpenCL

在 3.1 版被加入.

Finds Open Computing Language (OpenCL).

在 3.10 版被加入: Detection of OpenCL 2.1 and 2.2.

Imported Targets

在 3.7 版被加入.

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

OpenCL::OpenCL

Target providing OpenCL usage requirements.

結果變數

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.

快取變數

The following cache variables may also be set:

OpenCL_INCLUDE_DIR

The OpenCL include directory.

OpenCL_LIBRARY

The path to the OpenCL library.

範例

Finding OpenCL and linking it to a project target:

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