Alex Rivera | Logout

CMake can't find FFMPEG in custom install path

Asked 2011-03-30T21:55:48.437
11

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...

Edit
Report

1 Answer

23

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.

answered 2011-04-06T14:01:29.290

Your Answer