马春杰杰博客
致力于深度学习经验分享!

[mcj]CMake Error: The following variables are used in this project, but they are set to NOTFOUND.

使用Cmake编译opencv源码遇到如下错误
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CUDA_nppi_LIBRARY (ADVANCED)
linked by target “opencv_cudev” in directory D:/Cproject/opencv/opencv/sources/modules/cudev
linked by target “opencv_cudev” in directory D:/Cproject/opencv/opencv/sources/modules/cudev
linked by target “opencv_test_cudev” in directory D:/Cproject/opencv/opencv/sources/modules/cudev/test
linked by target “opencv_core” in directory D:/Cproject/opencv/opencv/sources/modules/core
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
原因解析:
cuda9不再支持2.0架构
解决方案如下:
1).找到FindCUDA.cmake文件
找到行
find_cuda_helper_libs(nppi)
改为

2).找到行

set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppi_LIBRARY};${CUDA_npps_LIBRARY}")
改为
set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")
3).找到行
unset(CUDA_nppi_LIBRARY CACHE)
改为

4).找到文件OpenCVDetectCUDA.cmake

修改以下几行

改为

5).cuda9中有一个单独的halffloat(cuda_fp16.h)头文件,也应该被包括在opencv的目录里

将头文件cuda_fp16.h添加至 opencv\modules\cudev\include\opencv2\cudev\common.hpp

即在common.hpp中添加

#include <cuda_fp16.h>

重新生成即可

本文最后更新于2019年5月21日,已超过 1 年没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!

如果你对这篇文章有什么疑问或建议,欢迎下面留言提出,我看到会立刻回复!

打赏
未经允许不得转载:马春杰杰 » [mcj]CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
超级便宜的原生ChatGPT4.0

留个评论吧~ 抢沙发 评论前登陆可免验证码!

私密评论
  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址(选填,便于回访^_^)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

登录

忘记密码 ?

切换登录

注册