Can someone please tell me what I have to? I'm trying to setup my build using CMake. My code and its' error is the following. How do I make CMakeLists?

(cv) pi@raspberrypi:~/build $ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_PYTHON_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.14/modules -D BUILD_EXAMPLES=ON ..
CMake Error: The source directory "/home/pi" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.

  • Perhaps cmake . initially.
    – joan
    Jun 18 at 7:51

You're executing this command in the wrong folder. You should create a build subdirectory in the folder where you cloned OpenCV and run the command from there if you use .. as an argument to CMake.

Alternatively, replace .. by the actual path to the OpenCV source code, this is what they recommend in the official installation instructions: https://docs.opencv.org/4.5.2/d7/d9f/tutorial_linux_install.html


Are you sure you want to install it to /usr/local? You seem to have a Python virtual environment active, do you want to install OpenCV system-wide or only in the virtual environment? In case of the latter, you might want to use -D CMAKE_INSTALL_PREFIX="$VIRTUAL_ENV".

Not the answer you're looking for? Browse other questions tagged or ask your own question.