In my CMakeLists.txt I have:
cmake_minimum_required(VERSION 3.9)
# ... etc etc ...
find_package(CUDA 8.0 REQUIRED)
find_package(OpenCL REQUIRED)
and this finds CUDA and OpenCL. But - it prefers my system's non-NVIDIA OpenCL library over the library which comes with the CUDA installation. Actually, it's worse than that, since I get:
//Path to a file.
OpenCL_INCLUDE_DIR:PATH=/usr/local/cuda/include
//Path to a library.
OpenCL_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libOpenCL.so
in my CMakeCache.txt file.
How can I, from within CMakeLists.txt (i.e. not as the user but as the package maintainer), get CMake to switch the order of preference?
Note: Yes, it needs to be CMake 3.9 for compatibility reasons.