build - 将 CMake 项目指向特定的包含文件

标签 build opencv ffmpeg cmake

我正在尝试构建启用了 FFMPEG 的 OpenCV 2.3.0。由于 Ubuntu 11.10 仅提供 0.7 版的 libavcodec/format,而票证 #1020(下面的链接)表明它应该适用于 0.8。

如果我尝试编译,我会收到以下错误:

[ 18%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_ffmpeg.o
In file included from /home/chris/src/OpenCV-2.3.0/modules/highgui/src/cap_ffmpeg.cpp:45:0:
/home/foo/src/OpenCV-2.3.0/modules/highgui/src/cap_ffmpeg_impl.hpp:103:36: fatal error: libavformat/avformat.h: No such file or directory
compilation terminated.

此文件位于 /opt/linux64-debug/include/ffmpeg/libavformat/avformat.h。我尝试使用 CMAKE_INCLUDE_{DIRECTORY,PATH}、CMAKE_PREFIX_PATH 和 CMAKE_LIBRARY_PATH 指向 make。这些都没有用。 (我总是使用路径 /opt/linux64-debug/include/ffmpeg。)

https://code.ros.org/trac/opencv/ticket/1020

最佳答案

试试 include_directories() 命令。在我的 CMakeLists.txt 文件中,我这样使用它:

include_directories(. /opt/special/headers/in/here)

add_executable(helloworld helloworld.c)

我从来没有遇到过任何问题。

关于build - 将 CMake 项目指向特定的包含文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7766460/

相关文章:

visual-studio-2010 - 禁止在构建时创建 *.vshost.exe 和其他文件

database - 触发 Jenkins 基于数据库更改构建

python - 线型匹配 - Opencv?

ffmpeg - 使用 FFMPEG 添加支柱条

android - 如何使用 ffmpeg 和 sdl 为 Android 制作视频播放器?

ffmpeg PNG 到 mp4 - 黑屏

.net - DOTNET1011 : Framework not installed: . NETFramework

ubuntu - 如何创建可在不同版本的 Ubuntu 上使用的 deb 包

python - findChessboardCorners() 返回的角数组的形状

c++ - img.at<uchar>(i,j) 是什么意思?