Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake can't find FFMPEG in custom install path

I am compiling a dependency for a project on Ubuntu 10.10, and instead of having it install to /usr/local by default, I am instead installing it to /tmp/stage/usr/local. How do I go about informing CMake of the location of this custom installed dependency when I call it to generate the build files for said project.

I am running CMake 2.8.1, and I have tried to set CMAKE_PREFIX_PATH on the cmake command line, like so

cmake -D CMAKE_PREFIX_PATH=/tmp/stage/usr/local

but this doesn't seem to make a difference - the project doesn't seem to detect the dependency.

Also, if it matters, the project in question is OpenCV 2.2, and the dependency in question is FFMPEG...

like image 249
hatboyzero Avatar asked Mar 30 '11 21:03

hatboyzero


1 Answers

I figured out how to fix my problem, and trying to point CMake at the appropriate install location isn't the issue.

Apparently, CMake is unable to find the pkg-config files for FFMPEG (i.e. libavcodec.pc, libavdevice.pc, etc.) that tell it where the FFMPEG headers and libraries are located. In a typical install scenario, these files would be located at /usr/lib/pkgconfig. However because of the custom install location, they are instead located at /tmp/stage/usr/local/lib/pkgconfig.

So that CMake could find these files, I had to add the following environment variable:

export PKG_CONFIG_PATH=/tmp/stage/usr/local/lib/pkgconfig

After which point, OpenCV built against FFMPEG as expected.

like image 183
hatboyzero Avatar answered Oct 29 '22 09:10

hatboyzero