FindOpenCL¶
Added in version 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.
Added in version 3.24: Detection of OpenCL 3.0.
Added in version 3.10: Detection of OpenCL 2.1 and 2.2.
Imported Targets¶
This module provides the following Imported Targets:
OpenCL::OpenCLAdded in version 3.7.
Target encapsulating the OpenCL usage requirements, available if OpenCL has been found.
Result Variables¶
This module defines the following variables:
OpenCL_FOUNDBoolean indicating whether (the requested version of) OpenCL was found.
OpenCL_VERSIONAdded in version 4.2.
Highest supported OpenCL version found in form of
<major>.<minor>(e.g.,1.2).OpenCL_VERSION_MAJORThe major version of the OpenCL implementation.
OpenCL_VERSION_MINORThe minor version of the OpenCL implementation.
OpenCL_INCLUDE_DIRSInclude directories needed to use OpenCL.
OpenCL_LIBRARIESLibraries needed to link to OpenCL.
Cache Variables¶
The following cache variables may also be set:
OpenCL_INCLUDE_DIRThe OpenCL include directory.
OpenCL_LIBRARYThe path to the OpenCL library.
Deprecated Variables¶
The following variables are provided for backward compatibility:
OpenCL_VERSION_STRINGDeprecated since version 4.2: Use
OpenCL_VERSION, which has the same value.Highest supported OpenCL version found in form of
<major>.<minor>.
Examples¶
Finding OpenCL and linking it to a project target:
find_package(OpenCL)
target_link_libraries(project_target PRIVATE OpenCL::OpenCL)