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

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

问题描述

我正在尝试通过C ++控制树莓派相机.我找到了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

将"raspicam"的安装前缀添加到CMAKE_PREFIX_PATH或进行设置"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时.如果在该目录中没有它,则可以简单地搜索树莓派以查找它的位置,或者可以转到以前安装过的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天全站免登陆