2014-01-20 07:58:58 -08:00
|
|
|
# Once done these will be defined:
|
|
|
|
#
|
2014-05-21 22:50:56 -07:00
|
|
|
# LIBAVFORMAT_FOUND
|
|
|
|
# LIBAVFORMAT_INCLUDE_DIRS
|
|
|
|
# LIBAVFORMAT_LIBRARIES
|
2014-07-18 20:05:42 -07:00
|
|
|
|
2014-09-15 10:58:31 -07:00
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
if (PKG_CONFIG_FOUND)
|
|
|
|
pkg_check_modules(_AVFORMAT QUIET libavformat)
|
|
|
|
endif()
|
2014-01-20 07:58:58 -08:00
|
|
|
|
2014-09-15 10:58:31 -07:00
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
set(_lib_suffix 64)
|
|
|
|
else()
|
|
|
|
set(_lib_suffix 32)
|
2014-01-20 07:58:58 -08:00
|
|
|
endif()
|
|
|
|
|
2014-09-15 10:58:31 -07:00
|
|
|
set(FFMPEG_PATH_ARCH FFmpegPath${_lib_suffix})
|
|
|
|
|
|
|
|
find_path(FFMPEG_INCLUDE_DIR
|
|
|
|
NAMES libavformat/avformat.h
|
|
|
|
HINTS
|
|
|
|
${_AVFORMAT_INCLUDE_DIRS}
|
|
|
|
"${CMAKE_SOURCE_DIR}/additional_install_files/include"
|
|
|
|
"$ENV{obsAdditionalInstallFiles}/include"
|
|
|
|
ENV FFmpegPath
|
|
|
|
ENV ${FFMPEG_PATH_ARCH}
|
|
|
|
PATHS
|
|
|
|
/usr/include /usr/local/include /opt/local/include /sw/include
|
|
|
|
PATH_SUFFIXES ffmpeg libav)
|
|
|
|
|
|
|
|
find_library(AVFORMAT_LIB
|
|
|
|
NAMES ${_AVFORMAT_LIBRARIES} avformat-ffmpeg avformat
|
|
|
|
HINTS
|
|
|
|
${_AVFORMAT_LIBRARY_DIRS}
|
|
|
|
"${FFMPEG_INCLUDE_DIR}/../lib"
|
|
|
|
"${FFMPEG_INCLUDE_DIR}/../lib${_lib_suffix}"
|
|
|
|
"${FFMPEG_INCLUDE_DIR}/../libs${_lib_suffix}"
|
|
|
|
"${FFMPEG_INCLUDE_DIR}/lib"
|
|
|
|
"${FFMPEG_INCLUDE_DIR}/lib${_lib_suffix}"
|
|
|
|
PATHS
|
|
|
|
/usr/lib /usr/local/lib /opt/local/lib /sw/lib)
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(Libavformat DEFAULT_MSG AVFORMAT_LIB FFMPEG_INCLUDE_DIR)
|
|
|
|
mark_as_advanced(FFMPEG_INCLUDE_DIR AVFORMAT_LIB)
|
|
|
|
|
|
|
|
if(LIBAVFORMAT_FOUND)
|
|
|
|
set(LIBAVFORMAT_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR})
|
|
|
|
set(LIBAVFORMAT_LIBRARIES ${AVFORMAT_LIB})
|
|
|
|
endif()
|