CMake问题-找不到由"OpenCV"提供的软件包配置文件. [英] CMake issues -- Could not find a package configuration file provided by "OpenCV"

查看:335
本文介绍了CMake问题-找不到由"OpenCV"提供的软件包配置文件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用Cmake构建项目时遇到了问题,这是我以前从未做过的.我是C ++和Cmake和Makefiles概念的新手.我正在尝试从GitHub上的一些代码重新创建一些结果.如果您想更详细地了解这些说明/文件,可以在这里找到:

I am having an issue building a project using Cmake, which I have never done before. I am new to C++ and the concept of Cmake and Makefiles. I am trying to recreate some results from some code off of GitHub. The instructions/files can be found here if you would like to take a more detailed look:

https://github.com/jan-dufek/Fotokite

所以基本上,他列出了四个步骤:

So basically there are four steps he lists to do:

1-)安装CMake:

1-)Install CMake:

https://cmake.org

2-)在终端中,将目录更改为项目的根目录,然后运行以下命令以生成makefile:

2-) In Terminal, change directory into the root directory of the project and run the following command to generate makefile:

cmake.

3-)编译项目:

制作

4-)运行:

./Fotokite

./Fotokite

基本上我现在停留在第二步,因为导航到该文件夹​​并运行"cmake"后,我在终端中始终遇到以下错误.

Basically I am stuck on the 2nd step right now because I keep getting the following error in my terminal after navigating to the folder and running "cmake .".

The C compiler identification is AppleClang 11.0.3.11030032
The CXX compiler identification is AppleClang 11.0.3.11030032
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
Detecting C compile features
Detecting C compile features - done
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped     
Detecting CXX compile features
Detecting CXX compile features - done
CMake Error at CMakeLists.txt:5 (find_package):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.


Could not find a package configuration file provided by "OpenCV" with any
of the following names:

OpenCVConfig.cmake

opencv-config.cmake

Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.

我也将OpenCV下载到了我的桌面上,我尝试将路径合并到Cmake文件中,但是仍然没有运气.

I have OpenCV downloaded onto my Desktop as well, and I tried incorporating the path into the Cmake file but still am not having any luck.

cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
project(Fotokite)
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
file(GLOB SOURCES
*.h
*.hpp
*.cpp
)
list(FILTER SOURCES EXCLUDE REGEX "main.*.cpp")
list(FILTER SOURCES EXCLUDE REGEX "Visualization.*")
foreach (FILE "" Takeoff GoToWaypoint ExecutePath Land)
add_executable(Fotokite${FILE} ${SOURCES} main${FILE}.cpp)
target_link_libraries(Fotokite${FILE} ${OpenCV_LIBS} pthread)
endforeach(FILE)

第一次在此网站上发布,如果不清楚,抱歉,如果可以,我可以提供更多详细信息!期待您的回复.

First time posting on this website so sorry if something is unclear, if so I can provide more details! Looking forward to your responses.

推荐答案

在使用buildroot生成内容时,我也遇到了类似的问题.

I have seen similar issue while using buildroot to build something.

当我检查日志时,发现

>>> xxxxxx Configuring
>>> xxxxxx Installing to target
xxxxxxxxxxxxxx  DESTDIR= xxxxxxxxxxxxxxx

请仔细查看 DESTDIR 变量.它可能会受到" FOO_INSTALL_STAGING = YES "的影响.xxx.mk文件中的命令.

please take a close look at the DESTDIR variable. it might be impacted by "FOO_INSTALL_STAGING = YES" command in xxx.mk file.

这篇关于CMake问题-找不到由"OpenCV"提供的软件包配置文件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆