编译opencv示例:未知cmake命令ocv_check_dependencies [英] Compiling opencv samples: unknown cmake command ocv_check_dependencies
问题描述
我正在尝试构建源包附带的 OpenCV 示例,我得到以下内容:
I am trying to build the OpenCV samples which come with the source package and I get the following:
CMake Error at CMakeLists.txt:10 (ocv_check_dependencies):
Unknown CMake command "ocv_check_dependencies".
我确实使用
cmake .
make
sudo make install
并且我得到了一个教程片段(因此我认为它作为库正确安装).但是,编译示例不起作用.
and I got a tutorial snippet working (thus I suppose it is installed correctly as a library). However, compiling the samples does not work.
我想我必须以某种方式将 CMake 配置为具有ocv_check_dependencies"——但如何配置?我迷路了!
I guess I have to somehow configure CMake to have "ocv_check_dependencies" - but how? I am lost!
推荐答案
我知道了.
为了构建示例,必须通过 -D
提供 cmake 的默认配置来更改它.我做错的是我试图从 samples
目录中执行 cmake.
In order to build the samples one has to change the default configuration for cmake by providing it via -D
. What I did wrong was that I tried to execute cmake from within the samples
directory.
构建示例的正确方法是像这样调用 cmake(从解压存档的根目录中):
The proper way to build the samples is invoking cmake like so (from within the root directory of the unpacked archive):
cmake -DBUILD_SAMPLES .
这将打开样本.可以继续使用make,make install than.构建后可以在bin
中找到示例.
which will turn samples ON. One can proceed using make, make install than. The samples can be found in bin
after building.
另见常见问题
这篇关于编译opencv示例:未知cmake命令ocv_check_dependencies的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!