FindOpenCL

在 3.1 版被加入.

Finds Open Computing Language (OpenCL):

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

OpenCL is a framework for writing programs that execute across heterogeneous platforms, such as CPUs, GPUs, and other accelerators.

在 3.24 版被加入: Detection of OpenCL 3.0.

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

Imported Targets

This module provides the following Imported Targets:

OpenCL::OpenCL

在 3.7 版被加入.

Target encapsulating the OpenCL usage requirements, available if OpenCL has been found.

結果變數

該模組定義了以下變數:

OpenCL_FOUND

Boolean indicating whether (the requested version of) OpenCL was found.

OpenCL_VERSION

在 4.2 版被加入.

Highest supported OpenCL version found in form of <major>.<minor> (e.g., 1.2).

OpenCL_VERSION_MAJOR

The major version of the OpenCL implementation.

OpenCL_VERSION_MINOR

The minor version of the OpenCL implementation.

OpenCL_INCLUDE_DIRS

Include directories needed to use OpenCL.

OpenCL_LIBRARIES

Libraries needed to link to OpenCL.

快取變數

The following cache variables may also be set:

OpenCL_INCLUDE_DIR

The OpenCL include directory.

OpenCL_LIBRARY

The path to the OpenCL library.

已棄用的變數

The following variables are provided for backward compatibility:

OpenCL_VERSION_STRING

在 4.2 版之後被棄用: Use OpenCL_VERSION, which has the same value.

Highest supported OpenCL version found in form of <major>.<minor>.

範例

Finding OpenCL and linking it to a project target:

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