cmake: check if ffmpeg libswscale is present

This commit is contained in:
scribam 2017-11-22 21:54:38 +01:00 committed by Ani
parent 7d3a528871
commit d05071221e

View file

@ -1,4 +1,4 @@
# - Try to find ffmpeg libraries (libavcodec, libavformat and libavutil) # - Try to find ffmpeg libraries (libavcodec, libavformat, libavutil and libswscale)
# Once done this will define # Once done this will define
# #
# FFMPEG_FOUND - system has ffmpeg or libav # FFMPEG_FOUND - system has ffmpeg or libav
@ -7,6 +7,7 @@
# FFMPEG_LIBAVCODEC # FFMPEG_LIBAVCODEC
# FFMPEG_LIBAVFORMAT # FFMPEG_LIBAVFORMAT
# FFMPEG_LIBAVUTIL # FFMPEG_LIBAVUTIL
# FFMPEG_LIBSWSCALE
# #
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org> # Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
# Modified for other libraries by Lasse Kärkkäinen <tronic> # Modified for other libraries by Lasse Kärkkäinen <tronic>
@ -27,6 +28,7 @@ else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
pkg_check_modules(_FFMPEG_AVCODEC libavcodec) pkg_check_modules(_FFMPEG_AVCODEC libavcodec)
pkg_check_modules(_FFMPEG_AVFORMAT libavformat) pkg_check_modules(_FFMPEG_AVFORMAT libavformat)
pkg_check_modules(_FFMPEG_AVUTIL libavutil) pkg_check_modules(_FFMPEG_AVUTIL libavutil)
pkg_check_modules(_FFMPEG_SWSCALE libswscale)
endif (PKG_CONFIG_FOUND) endif (PKG_CONFIG_FOUND)
find_path(FFMPEG_AVCODEC_INCLUDE_DIR find_path(FFMPEG_AVCODEC_INCLUDE_DIR
@ -50,7 +52,12 @@ else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
) )
if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT) find_library(FFMPEG_LIBSWSCALE
NAMES swscale
PATHS ${_FFMPEG_SWSCALE_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
)
if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT AND FFMPEG_LIBSWSCALE)
set(FFMPEG_FOUND TRUE) set(FFMPEG_FOUND TRUE)
endif() endif()
@ -61,6 +68,7 @@ else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
${FFMPEG_LIBAVCODEC} ${FFMPEG_LIBAVCODEC}
${FFMPEG_LIBAVFORMAT} ${FFMPEG_LIBAVFORMAT}
${FFMPEG_LIBAVUTIL} ${FFMPEG_LIBAVUTIL}
${FFMPEG_LIBSWSCALE}
) )
endif (FFMPEG_FOUND) endif (FFMPEG_FOUND)
@ -71,7 +79,7 @@ else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
endif (NOT FFMPEG_FIND_QUIETLY) endif (NOT FFMPEG_FIND_QUIETLY)
else (FFMPEG_FOUND) else (FFMPEG_FOUND)
if (FFMPEG_FIND_REQUIRED) if (FFMPEG_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libavcodec or libavformat or libavutil") message(FATAL_ERROR "Could not find libavcodec or libavformat or libavutil or libswscale")
endif (FFMPEG_FIND_REQUIRED) endif (FFMPEG_FIND_REQUIRED)
endif (FFMPEG_FOUND) endif (FFMPEG_FOUND)