【问题标题】:Point CMake project to specific include file将 CMake 项目指向特定的包含文件
【发布时间】:2011-12-07 15:55:54
【问题描述】:

我正在尝试构建启用 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

【问题讨论】:

    标签: build opencv ffmpeg cmake


    【解决方案1】:

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

    include_directories(. /opt/special/headers/in/here)
    
    add_executable(helloworld helloworld.c)
    

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

    【讨论】:

      猜你喜欢
      • 2017-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-21
      相关资源
      最近更新 更多