当我尝试使用cmake ..
时,Windows cmd指出错误:
CMake Error at CMakeLists.txt:15(find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MOUDLE_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.
我在网上搜索了许多可能的解决方案,但它不起作用...... 例如:
在命令行cmake -DCMAKE_PREFIX_PATH="C:\OpenCV" ..
中书写
但似乎cmd根本不知道DCMAKE ......
或cmake -DOpenCV_DIR="C:\OpenCV\build\x86\vc10\lib" ..
也无效。
我不确定这些解决方案是在Linux还是Windows,因为我的计算机是windows7系统...我认为错误已经解释了如何修复它,这是
将“OpenCV”的安装前缀添加到CAMKE_PREFIX_PATH或将“OpenCV_DIR”设置为包含上述文件之一的目录。
但我不确切知道如何编写命令代码...... 请给我一些提示......
答案 0 :(得分:-2)
一个快速的解决方案可能是编辑 CMakeLists.txt
以包含 OpenCV_DIR
变量的路径,方法是在 find_package(OpenCV REQUIRED)
之前添加以下行:>
set("OpenCV_DIR" "C:\OpenCV\build\x86\vc10\lib")
还可以通过以下方式找到包含 OpenCVConfig.cmake
的文件夹:
find / -name "OpenCVConfig.cmake"