2121if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
2222 # in cache already
2323 set (FFMPEG_FOUND TRUE )
24- else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR )
24+ else ()
2525 # use pkg-config to get the directories and then use these values
2626 # in the FIND_PATH() and FIND_LIBRARY() calls
2727 find_package (PkgConfig)
@@ -31,7 +31,7 @@ else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
3131 pkg_check_modules(_FFMPEG_AVUTIL libavutil)
3232 pkg_check_modules(_FFMPEG_SWSCALE libswscale)
3333 pkg_check_modules(_FFMPEG_SWRESAMPLE libswresample)
34- endif (PKG_CONFIG_FOUND )
34+ endif ()
3535
3636 find_path (FFMPEG_AVCODEC_INCLUDE_DIR
3737 NAMES libavcodec/avcodec.h
@@ -64,9 +64,10 @@ else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
6464 PATHS ${_FFMPEG_SWRESAMPLE_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
6565 )
6666
67- if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT AND FFMPEG_LIBSWSCALE AND FFMPEG_LIBSWRESAMPLE)
68- set (FFMPEG_FOUND TRUE )
69- endif ()
67+ find_package_handle_standard_args(FFMPEG
68+ DEFAULT_MSG
69+ FFMPEG_LIBAVCODEC FFMPEG_LIBAVFORMAT FFMPEG_LIBSWSCALE FFMPEG_LIBSWRESAMPLE
70+ )
7071
7172 if (FFMPEG_FOUND)
7273 set (FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR} )
@@ -79,17 +80,6 @@ else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
7980 ${FFMPEG_LIBSWRESAMPLE}
8081 )
8182
82- endif (FFMPEG_FOUND)
83-
84- if (FFMPEG_FOUND)
85- if (NOT FFMPEG_FIND_QUIETLY)
86- message (STATUS "Found FFMPEG or Libav: ${FFMPEG_LIBRARIES} , ${FFMPEG_INCLUDE_DIR} " )
87- endif (NOT FFMPEG_FIND_QUIETLY)
88- else (FFMPEG_FOUND)
89- if (FFMPEG_FIND_REQUIRED)
90- message (FATAL_ERROR "Could not find libavcodec or libavformat or libavutil or libswscale or libswresample" )
91- endif (FFMPEG_FIND_REQUIRED)
92- endif (FFMPEG_FOUND)
93-
94- endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
83+ endif ()
9584
85+ endif ()
0 commit comments