FindOpenCL.cmake finds include dir but fails to find library on Windows with Cygwin
If you work in Cygwin on Windows (10), after having installed NVIDIA CUDA to its standard location, the FindOpenCL module (taken just now from here, but it's the same as in, say, 3.14.5) sets:
//Path to a file. OpenCL_INCLUDE_DIR:PATH=/cygdrive/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/include
//Path to a library. OpenCL_LIBRARY:FILEPATH=OpenCL_LIBRARY-NOTFOUND
and the configuration fails:
CMake Error at /usr/share/cmake-3.14.5/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find OpenCL (missing: OpenCL_LIBRARY) (found version "1.2") Call Stack (most recent call first): /usr/share/cmake-3.14.5/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) /usr/share/cmake-3.14.5/Modules/FindOpenCL.cmake:150 (find_package_handle_standard_args) CMakeLists.txt:4 (find_package) -- Configuring incomplete, errors occurred!
This is strange, since it should be trivial to find the library where you've also found the include file...
If we execute:
$ cmake -DOpenCL_LIBRARY="/cygdrive/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/lib/x64/OpenCL.lib" -S . -B build/
in the source directory, i.e. if we force the library path, then everything works fine, which means there isn't a legit reason not to find the library.
I'm not sure whether this issue is Cygwin-specific.