Using CMake to compile in OpenCV-2.4.3



嗨,我已经编写了一个打开图像文件的基本程序。我正在尝试使用CMake来编译它。这就是我的CMake文件的样子:

         cmake_minimum_required(VERSION 2.6)
         project( textures )
         find_package( OpenCV REQUIRED )
         add_executable( textures textures.cpp )
         target_link_libraries( textures ${OpenCV_LIBS} ) 

当我运行"cmake."时,我得到了以下错误。

         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.

         -- Configuring incomplete, errors occurred!

关于这意味着什么以及我如何解决它,有什么想法吗?谢谢

CMake正在查找文件FindOpenCV.CMake,因此请确保您拥有该文件(您可以在线搜索其他人的实现)。然后将此文件放在正确的目录中,并将此命令添加到CMakeLists.txt文件""中的项目行之后

 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/relative/path/to/your/file/")

其中CMAKE_SOURCE_DIR是源代码所在的位置。

相关内容

  • 没有找到相关文章

最新更新