Years ago, before CMake 3, we would write:
find_package(OpenCL REQUIRED)
include_directories(${OPENCL_INCLUDE_DIR})
target_link_libraries(my_app ${OPENCL_LIBRARY})
... but that's not idiomatic today. We use targets and target dependencies. But - what are these targets for OpenCL? What OpenCL target should my_app
depend on?
I'm specifically interested in how thing stand with CMake 3.14 and earlier (in case things changed with CMake 3.8 or some other version.) if not - any range of version would do.
This is how it should work today:
find_package(OpenCL REQUIRED)
target_link_libraries(my_app OpenCL::OpenCL)
and that should take care of includes and link libraries.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.