Skip to content

Instantly share code, notes, and snippets.

Created July 7, 2013 08:41
Show Gist options
  • Save anonymous/5942817 to your computer and use it in GitHub Desktop.
Save anonymous/5942817 to your computer and use it in GitHub Desktop.
FindFFmpeg.cmake
INCLUDE (FindPackageHandleStandardArgs)
FIND_PATH (FFMPEG_ROOT_DIR
NAMES libavcodec/avcodec.h include/libavcodec/avcodec.h
PATHS ENV FFMPEG_ROOT
DOC "FFmpeg root directory")
FIND_PATH (FFMPEG_INCLUDE_DIR
NAMES libavcodec/avcodec.h
HINTS ${FFMPEG_ROOT_DIR}
PATH_SUFFIXES include
DOC "FFmpeg include directory")
FOREACH(COMPONENT ${FFmpeg_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
SET( _FFmpeg_docstring "FFmpeg ${COMPONENT} library")
FIND_LIBRARY(${UPPERCOMPONENT} NAMES ${COMPONENT} HINTS ${FFMPEG_ROOT} DOC ${_FFmpeg_docstring})
endforeach()
IF(FFMPEG_ROOT_DIR-NOTFOUND OR FFMPEG_INCLUDE_DIR-NOTFOUND)
SET(FFMPEG-NOTFOUND)
ELSE()
SET(FFMPEG-FOUND)
SET(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR})
SET(FFMPEG_LIBRARIES "")
FOREACH(COMPONENT ${FFmpeg_FIND_COMPONENTS})
STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
IF(NOT ${UPPERCOMPONENT}-NOTFOUND)
MESSAGE(STATUS "found FFmpeg component ${COMPONENT}")
LIST(APPEND FFMPEG_LIBRARIES ${FFmpeg_${UPPERCOMPONENT}_LIBRARY})
ELSE()
MESSAGE(STATUS "cannot found FFmpeg component ${COMPONENT}")
ENDIF()
ENDFOREACH()
ENDIF()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment