4
votes

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:

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.

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

raspicamConfig.cmake
raspicam-config.cmake

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.

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

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? :/

1
Your raspicam installation should have file raspicamConfig.cmake somewhere. Find it, and set raspicam_DIR variable to directory where this file is: cmake -Draspicam_DIR=<dir> .... BTW, error message tells exactly that.Tsyvarev
Thanks a lot for you reply! Sorry, I'm new here and don't really know what I do.... So, I found raspicamConfig.cmake (Using comand pwd found it's location /home/pi/Downloads/raspicam-0.1.3/build). Then I just entered this address instead of <dir> in a command you send and clicked enter in terminal. The erroe I have got is "Parse error in command line argument: -Draspicam_DIR /Should be: VAR:Type value /cMake Error: No cmake script provided / CMake error: Problem processing arguments. AbortingAntons Osadchijs
Hm, try cmake -Draspicam_DIR:PATH=/home/pi/Downloads/raspicam-0.1.3 ... then. At least resort you can modify value of raspicam_DIR variable in the CMakeCache.txt file under your build directory and run cmake again.Tsyvarev
Just got one more error. Now it says CMake Error: The source directory "/home/pi/raspicam/build/..." is a file, not a directoryAntons Osadchijs
Run cmake -Draspicam_DIR:PATH=/home/pi/Downloads/raspicam-0.1.3/build <source-dir> where <source-dir> is directory contained your CMakeLists.txt. If you run cmake from source directory, then <source-dir> is just ..Tsyvarev

1 Answers

3
votes

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

you can also add

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

to your cmake file before you use

find_package(raspicam REQUIRED)

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.