By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project

问题:

By not providing

CMake Error at CMakeLists.txt:3 (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" with any
of the following names:

OpenCVConfig.cmake
opencv-config.cmake

Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.

 

解决方法一(源自https://www.cnblogs.com/LiuSY/p/5808210.html):

打开你的CMakeLists.txt,添加set(OpenCV_DIR D:/Opencv2.4/opencv/build) 注意这是你的OpenCVConfig.cmake的路径(注意路径中的斜杠方向

By not providing

再编译就可以啦

By not providing

解决方法二:

楼主用了方法一并未实现该有的效果,可能哪里操作出错了,但是发现更简单的方法。

点击下图的红圈OpenCV_DIR处,或出现后方的...按钮,点击该按钮,选择文件夹路径,该文件夹路径就是你的OpenCVConfig.cmake的路径,例如:D:/socure/OpenCV/opencv-3.3.1-mybuild。

By not providing

然后点击configure,gererate,出现

By not providing

好的,恭喜你解决问题了

PS:如果你的问题解决了,点赞关注来一波~~ ^_^

你可能感兴趣的:(OpenCV)