2

I ran the following lines

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.0.0/modules \
    -D BUILD_EXAMPLES=ON 

and got this error

CMake Error: The source directory /home/pi/opencv-3.0.0/build/BUILD_EXAMPLES=ON does not exist`

How could this be solved?

Zanna
  • 70,465
Nauman Ahmed
  • 21
  • 1
  • 1
  • 2

1 Answers1

9

The last argument to the cmake command needs to be a directory containing a CMakeList.txt file.

Usually that's either the current directory . or the parent directory .. in the case of an out-of-source build where you are running the command from a separate build subdirectory:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_C_EXAMPLES=ON \
    -D INSTALL_PYTHON_EXAMPLES=ON \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.0.0/modules \
    -D BUILD_EXAMPLES=ON ..

[I suspect you are following instructions that used .. and misinterpreted it as standing in for an arbitrary list of -D options rather than an actual directory argument]

steeldriver
  • 136,215
  • 21
  • 243
  • 336