CMake Warning (dev) at cmake/OpenCVDetectPython.cmake:140 (find_package): Policy CMP0148 is not set

本文描述了在OpenCV编译过程中遇到的CMake警告,涉及PolicyCMP0148和CMP0146,指出相关政策未设置且已过时。提供了在CMakeLists.txt中添加代码以解决这些警告的方法。
摘要由CSDN通过智能技术生成

1、原文

在opencv编译的时候

CMake Warning (dev) at cmake/OpenCVUtils.cmake:144 (find_package):
Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
the cmake_policy command to set the policy and suppress this warning.`


Call Stack (most recent call first):
cmake/OpenCVDetectPython.cmake:64 (find_host_package)
cmake/OpenCVDetectPython.cmake:271 (find_python)
CMakeLists.txt:643 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.


CMake Warning (dev) at cmake/OpenCVUtils.cmake:144 (find_package):
Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake --help-policy CMP0146" for policy details.  Use the cmake_policy command to
set the policy and suppress this warning.`


Call Stack (most recent call first):
cmake/OpenCVDetectCUDA.cmake:21 (find_host_package)
cmake/OpenCVFindLibsPerf.cmake:43 (include)
CMakeLists.txt:750 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

2、说明

报错的意思是cmake的规则没有被设置,之前的过时了。可参考https://cmake.org/cmake/help/latest/policy/CMP0148.html

3、解决

在OpenCVDetectPython.cmake添加下面内容即可。

if(POLICY CMP0148) 
cmake_policy(SET CMP0148 OLD)
endif()

  • 9
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值