I'm trying to use cmake to install opencv. In the opencv instruction page, I find the following example:
cd ~/opencv
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
As I understand it, I should use cmake to generate Makefile in the new directory I created, which in this example should be ~/opencv/release. But I don't quite understand the last line. In cmake help, I find:
cmake -D <var>:<type>=<value> = create a cmake cache entry
What does it mean? Especially this part: "<var>:<type>=<value>"
, I don't understand why the example gives "CMAKE_BUILD_TYPE=RELEASE"
and"CMAKE_INSTALL_PREFIX=/usr/local .."
Your help is greatly appreciated!
From the CMake Documentation:
- -D <var>:<type>=<value>: Create a cmake cache entry.
When cmake is first run in an empty build tree, it creates a CMakeCache.txt file and populates it with customizable settings for the project. This option may be used to specify a setting that takes priority over the project's default value. The option may be repeated for as many cache entries as desired.
The :<type>
could be read as optional.
Maybe you can try:
cd ~/opencv
mkdir release
cd release
cmake -D'CMAKE_BUILD_TYPE=RELEASE' -D'CMAKE_INSTALL_PREFIX=/usr/local'
Just use ' ' surround the parameters and do not leave any blank between -D and ' and it can work.
I encountered some problems when I configure OpenCV with -D parameter.
And I think -D option just change some default parameters for compiling and installing the pkg.
Just as you inferred, CMAKE_BUILD_TYPE=RELEASE
means you want to build a "Release" version of the opencv package, and CMAKE_INSTALL_PREFIX=/usr/local
means you want to specify the install path of it while using make install
command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With