我正在尝试构建依赖于 OpenCV 的项目。我使用 macports 安装了 Opencv,当我尝试构建项目时,cmake 给出以下输出:
CMake Error at CMakeLists.txt:47 (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.
我对这个问题进行了一些搜索并添加了以下环境。$HOME/.profile
我的文件的变量
export DYLD_LIBRARY_PATH=/opt/local/lib:$DYLD_LIBRARY_PATH
export CMAKE_PREFIX_PATH=/opt/local
没有成功。我检查了一下,所有 opencv 文件都安装在 /opt/local/lib 和 /opt/local/include/opencv 目录中。OpenCVConfig.cmake
在以下路径中也有 :
/opt/local/lib/cmake/OpenCVConfig.cmake
如何让cmake知道opencv的安装路径?以前我使用 cmake 自己构建 OpenCV 并安装到 /usr/local 中,然后它工作正常,没有任何其他修复。但是我在使用 ffmpeg 时遇到了一些问题,现在我改用 macports。