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()