CMake Error: The following variables are used in this project, but they are set to NOTFOUND.错误引发的深思:
缺少库:
opencv_dep_CUDA_cufft_LIBRARY
opencv_dep_CUDA_nppc_LIBRARY
opencv_dep_CUDA_nppi_LIBRARY
opencv_dep_CUDA_npps_LIBRARY
参考链接:https://stackoverflow.com/questions/33097558/cmake-cuda-libraries-not-found-when-compiling-opencv
Thanks to tips from Drop in the comments, I solved this problem. In order to close this question, I'm answering my own question.
It's a "Win32 or x64" architecture problem. Since NVIDIA only provides cufft
, nvblas
, nppc
, nppi
, npps
libs for x64, it's naturally impossible for CMAKE to find these libs for configuring a Win32 OpenCV library.
My solution was to choose Visual Studio 11 Win64 instead of Visual Studio 11 as generator in CMAKE. So that CMAKE will automatically load libs from <CUDA_DIR>\lib\x64
rather than <CUDA_DIR>\lib\Win32
. Further more, I also need to load all the other libs required by OpenCV in 64 bit version, such as OpenGL. I will also need to compile OpenCV in x64 architecture. All the code I'm going to write in the future will have to build and debug in x64 only.
E:\opencv2.4.13\cuda_vc14\ install\include
E:\opencv2.4.13\cuda_vc14\ install\include\opencv
E:\opencv2.4.13\cuda_vc14\ install\include\opencv2
E:\opencv2.4.13\cuda_vc14\ install\x64\vc14\lib
C:\Program Files\ NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib\x64
E:\opencv2.4.13\cuda_vc14\ install\x64\vc14\bin
opencv_ml2413d.lib
opencv_calib3d2413d.lib
opencv_contrib2413d.lib
opencv_core2413d.lib
opencv_features2d2413d.lib
opencv_flann2413d.lib
opencv_gpu2413d.lib
opencv_highgui2413d.lib
opencv_imgproc2413d.lib
opencv_legacy2413d.lib
opencv_objdetect2413d.lib
opencv_ts2413d.lib
opencv_video2413d.lib
opencv_nonfree2413d.lib
opencv_ocl2413d.lib
opencv_photo2413d.lib
opencv_stitching2413d.lib
opencv_superres2413d.lib
opencv_videostab2413d.lib