windows下配置cmake+opencv报错:
find_package(OpenCV 4.3.0 REQUIRED)报错:
CMake Error at CMakeLists.txt:8 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" (requested
version 4.3.0) with any of the following names:
OpenCVConfig.cmake
opencv-config.cmake
解决步骤
例如我的OPENCV4.30安装在D:\otherlib\opencv430\opencv\build
1、配置环境变量OPENCV_DIR为D:\otherlib\opencv430\opencv\build\x64\vc15\lib
2、添加对应的path路径为%OPENCV_DIR%/../bin
3、使用find_package(OpenCV 4.3.0 REQUIRED)