Cdroid/cmake/modules/FindFFMPEG.cmake

41 lines
1.3 KiB
CMake
Executable File

find_package(PkgConfig)
pkg_check_modules(PC_FFMPEG libavformat)
find_path(FFMPEG_INCLUDE_DIRS
NAMES libavformat/avformat.h
HINTS ${PC_FFMPEG_INCLUDEDIR}
${PC_FFMPEG_INCLUDE_DIRS}
)
find_library(AVFORMAT_LIBRARIES
NAMES avformat
HINTS ${PC_FFMPEG_LIBDIR}
${PC_FFMPEG_LIBRARY_DIRS}
)
find_library(AVCODEC_LIBRARIES
NAMES avcodec
HINTS ${PC_FFMPEG_LIBDIR}
${PC_FFMPEG_LIBRARY_DIRS}
)
find_library(AVUTILS_LIBRARIES
NAMES avutil
HINTS ${PC_FFMPEG_LIBDIR}
${PC_FFMPEG_LIBRARY_DIRS}
)
set(FFMPEG_LIBRARIES ${AVFORMAT_LIBRARIES} ${AVCODEC_LIBRARIES} ${AVUTILS_LIBRARIES})
if(FFMPEG_INCLUDE_DIRS AND FFMPEG_LIBRARIES)
set(FFMPEG_FOUND TRUE)
set(FFMPEG_LIBRARY ${FFMPEG_LIBRARIES})
set(FFMPEG_INCLUDE_DIR ${FFMPEG_INCLUDE_DIRS})
set(FFMPEG_VERSION ${PC_FFMPEG_VERSION})
endif()
#message(FATAL_ERROR "PC_FFMPEG_INCLUDEDIR=${PC_FFMPEG_INCLUDEDIR} FFMPEG_INCLUDE_DIRS=${FFMPEG_INCLUDE_DIRS}
# PC_FFMPEG_LIBDIR=${PC_FFMPEG_LIBDIR} FFMPEG_LIBRARIES=${FFMPEG_LIBRARIES} FFMPEG_FOUND=${FFMPEG_FOUND}")
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFMPEG REQUIRED_VARS FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES
FOUND_VAR FFMPEG_FOUND VERSION_VAR FFMPEG_VERSION)
mark_as_advanced(FFMPEG_LIBRARIES FFMPEG_LIBRARY FFMPEG_INCLUDE_DIRS FFMPEG_INCLUDE_DIR FFMPEG_FOUND)