Could not find module FindOpenCV.cmake ( Error in configuration process)

前端 未结 12 2222
既然无缘
既然无缘 2020-11-29 02:04

I wrote a CMakeLists.txt for a project in C++, which uses OpenCV libraries. When I try to create the project using cmake, I ge

12条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 02:21

    The error you're seeing is that CMake cannot find a FindOpenCV.cmake file, because cmake doesn't include one out of the box. Therefore you need to find one and put it where cmake can find it:

    You can find a good start here. If you're feeling adventurous you can also write your own.

    Then add it somewhere in your project and adjust CMAKE_MODULE_PATH so that cmake can find it.

    e.g., if you have

    CMakeLists.txt
    cmake-modules/FindOpenCV.cmake
    

    Then you should do a

    set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules)
    

    In your CMakeLists.txt file before you do a find_package(OpenCV)

提交回复
热议问题