CMake error when building OpenCV - CMakeLists not match

前端 未结 2 1490
遥遥无期
遥遥无期 2021-01-02 11:02

I tried to build OpenCV 3.1.0 on my Raspberry Pi 2B. Unfortunetly, when I trying:

cmake -D CMAKE_BUILD_TYPE=RELEASE \\ -D CMAKE_INSTALL_PREFIX=/usr/lo

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-02 11:28

    First, I hope you do run CMake outside your sources, in a separate directory. Not doing that is really not recommended

    To understand the error message you have to know a little bit on how CMake works.

    Basically, when you run

    cd /path/to/opencv
    mkdir build
    cd build
    cmake ..
    

    CMake generates a cache in the build dir (It's a simple file named CMakeCache.txt). This file contains some information like:

    • The path to the sources /path/to/opencv
    • The path to the build dir /path/to/opencv/build
    • The CMake Generator used (Ninja, Unix Makefiles ...)

    If you ever re-run CMake and change one of these values, (by re-running cmake with different arguments, setting an other generotor or moving files), CMake will complain with this kind of message.

    A good solution is then to delete the CMakeCache, or even the whole build dir to be safe.

提交回复
热议问题