我是要在Windows 下使用Cmake 编译opencv,然后导入QT进行使用。能帮我看一下这是哪里错了吗,都是按照博主的教程来的,还是不行,opencv contrib 也下了。
```c
CMake Deprecation Warning at CMakeLists.txt:22 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
CMake Deprecation Warning at CMakeLists.txt:72 (cmake_policy):
The OLD behavior for policy CMP0020 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at CMakeLists.txt:76 (cmake_policy):
The OLD behavior for policy CMP0022 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at CMakeLists.txt:81 (cmake_policy):
The OLD behavior for policy CMP0026 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
Can't detect runtime and/or arch
CMake Error at cmake/OpenCVCompilerOptions.cmake:21 (else):
Flow control statements are not properly nested.
Call Stack (most recent call first):
CMakeLists.txt:495 (include)
Configuring incomplete, errors occurred!
以下内容由CHATGPT及阿里嘎多学长共同生成、有用望采纳:
这个问题可能是由于缺少必要的依赖项或配置错误引起的。建议重新检查CMake配置是否正确,并确保已正确设置必要的环境变量和路径。
另外,您可以尝试使用CMake的GUI界面来配置和生成项目,以便更方便地调试和调整配置选项。
以下是可能有用的一些示例代码:
cmake_minimum_required(VERSION 3.0)
project(opencv_example)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(example example.cpp)
target_link_libraries(example ${OpenCV_LIBS})
在这个示例中,我们使用CMake来构建一个名为“opencv_example”的项目,并使用OpenCV作为依赖项。我们首先查找OpenCV,并将其包含目录添加到项目中。我们然后创建一个可执行文件“example”,并将其链接到OpenCV库。
希望这些信息有助于解决您的问题!
①官网下载:Download | CMake
·
根据自己的电脑选择合适的版本下载,一般都为64位。下载好后直接安装,点next的画面我就不展示了,我展示需要更改的。
②如图
③更改储存位置
④终端输入cmake验证
其实编译本质就是得到一堆文件,我这里有一份编译过的opev-contribu:链接如下:
https://download.csdn.net/download/Helloorld_1/87446941
可以参考这个:
https://blog.csdn.net/zhaitianbao/article/details/120223689