CMakeLists.txt:3 处的 CMake 错误(find_package) [英] CMake Error at CMakeLists.txt:3 (find_package)

查看:60
本文介绍了CMakeLists.txt:3 处的 CMake 错误(find_package)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过 C++ 控制 raspberry pi 相机.我找到了 api (raspicam),已安装,已检查.它适用于开发人员提供的示例.现在我创建了自己的项目并得到了 CMakeLists 的错误:

I'm trying to control raspberry pi camera via c++. I found api (raspicam), installed, checked. It works with an example provided by developer. Now I create my own project and got an error of CMakeLists:

CMakeLists.txt:3 (find_package) 中的 CMake 错误:通过在 CMAKE_MODULE_PATH 中不提供Findraspicam.cmake"这个项目要求 CMake 找到raspicam"提供的包配置文件,但是 CMake 没有找到.

CMake Error at CMakeLists.txt:3 (find_package): By not providing "Findraspicam.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "raspicam", but CMake did not find one.

找不到raspicam"提供的包配置文件以下名称:

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

raspicamConfig.cmake
raspicam-config.cmake

raspicamConfig.cmake
raspicam-config.cmake

在CMAKE_PREFIX_PATH中添加"raspicam"的安装前缀或设置raspicam_DIR"到包含上述文件之一的目录.如果raspicam"提供了一个单独的开发包或SDK,请确保它有已安装.

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

-- 配置不完整,出现错误!另见/home/pi/raspicam/build/CMakeFiles/CMakeOutput.log".

-- Configuring incomplete, errors occurred! See also "/home/pi/raspicam/build/CMakeFiles/CMakeOutput.log".

这是我的 CmakeLists.txt 文件:

And it is my CmakeLists.txt file:

make_minimum_required (VERSION 2.8)
project (raspicam_test)
find_package(raspicam REQUIRED)
add_executable (simpletest_raspicam simpletest_raspicam.cpp)
target_link_libraries (simpletest_raspicam ${raspicam_LIBS})

我刚刚开始并且已经遇到了问题...你们能帮帮我吗?:/

I just have started and already got a problem... Could you help please guys? :/

推荐答案

对于那些在 raspicam 的自述文件中使用默认说明的人(从 v 0.1.3 开始,将来可能会有所不同):

For those who used default instructions in the readme file of the raspicam (as of v 0.1.3, might differ in future):

你也可以添加

set(raspicam_DIR "/usr/local/lib/cmake")

在您使用之前添加到您的 cmake 文件

to your cmake file before you use

find_package(raspicam REQUIRED)

那是当你在/usr/local/lib/cmake 有 raspicamConfig.cmake 时.如果您在该目录中没有它,您可以简单地搜索您的 raspberry 以找到它的位置,或者您可以转到您之前安装的 raspicam 中的build"文件夹.然后再次键入 sudo make install,这将返回最新"消息以及所有文件列表及其位置,包括 raspicamConfig.cmake.希望这对一些人有所帮助.

That is when you have raspicamConfig.cmake at /usr/local/lib/cmake. If you did not have it at that directory, you can simply search your raspberry to find where it is or you can go to "build" folder in raspicam you used to install before. Then type sudo make install again, which will return "Up-to-date" message along with all a list of files and their locations, including raspicamConfig.cmake. Hope this helps to some.

这篇关于CMakeLists.txt:3 处的 CMake 错误(find_package)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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