I'm new to cmake, and I'm only using it to install opencv on my ubuntu linux. Here's the command I ran:
"cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/home/jinha/OCV/source"
Then it returns the error:
"FATAL: In-source builds are not allowed.
You should create separate directory for build files."
My current directory, /home/jinha/OCV/build/opencv, does contain the CMakefiles.txt file, so that's not the problem. I tried to change the directory in my command, but they all raise the same error. I saw the other answers on this issue, so I erased CMakeFiles folder and CMakeCache.txt file every time before I ran the command, but none of them worked. Thanks.
After you have success downloaded and unzipped OpenCV sources from sources you need create simple command-file install.sh. For example, your working dir will be /home/user/myopencv
So /home/user/myopencv/install.sh will be contain next code:
Next
And after the all you will get those executable files:
Enjoy!
It wants you to create a separate build directory (anywhere), and run cmake there. For example:
Note the
..
in this example telling cmake where to look for the source.In case you didn't remove
CMakeCache.txt
before building again, it will still show this error. So, please remember to deleteCMakeCache.txt
first before runningcmake
.