CMake 在自定义安装路径中找不到 FFMPEG
我正在 Ubuntu 10.10 上编译一个项目的依赖项,默认情况下我没有将其安装到 /usr/local,而是将其安装到 /tmp/stage/usr/local。当我调用 CMake 来生成所述项目的构建文件时,如何通知 CMake 此自定义安装依赖项的位置。
我正在运行CMAKE 2.8.1,并且我尝试在CMake命令行上设置CMAKE_PREFIX_PATH,
cmake -D CMAKE_PREFIX_PATH=/tmp/stage/usr/local
但这似乎并没有什么不同 - 该项目似乎并没有检测到依赖关系。
另外,如果重要的话,所讨论的项目是 OpenCV 2.2,所讨论的依赖项是 FFMPEG...
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想出了如何解决我的问题,并且尝试将 CMake 指向适当的安装位置不是问题。
显然,CMake 无法找到 FFMPEG 的 pkg-config 文件(即 libavcodec.pc、libavdevice.pc 等)来告诉它 FFMPEG 标头和库的位置。在典型的安装场景中,这些文件将位于 /usr/lib/pkgconfig。但是,由于自定义安装位置,它们位于 /tmp/stage/usr/local/lib/pkgconfig。
为了让 CMake 能够找到这些文件,我必须添加以下环境变量:
之后,OpenCV 按预期针对 FFMPEG 进行构建。
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:
After which point, OpenCV built against FFMPEG as expected.