Some further cleanup of the FFmpeg CMake find module.

This commit is contained in:
Leon Styhre 2021-05-14 10:21:33 +02:00
parent 63369ce48d
commit 3a82249163

View file

@ -1,32 +1,18 @@
# Locate ffmpeg # Locate FFmpeg
# This module defines
# FFMPEG_LIBRARIES
# FFMPEG_FOUND, if false, do not try to link to ffmpeg
# FFMPEG_INCLUDE_DIR, where to find the headers
# #
# $FFMPEG_DIR is an environment variable that would # This module defines:
# correspond to the ./configure --prefix=$FFMPEG_DIR # FFMPEG_FOUND
# FFMPEG_INCLUDE_DIRS
# FFMPEG_LIBRARIES
# #
# Created by Robert Osfield # Created by Robert Osfield
# Modified by Lukas Lalinsky # Modified by Lukas Lalinsky
# Modified by Leon Styhre # Modified by Leon Styhre
#
# In ffmpeg code, old version use "#include <header.h>" and newer use "#include <libname/header.h>" # Macro to find headers and library directories.
# In OSG ffmpeg plugin, we use "#include <header.h>" for compatibility with old version of ffmpeg # Example: FFMPEG_FIND(AVFORMAT avformat avformat.h)
# We have to search the path which contain the header.h (usefull for old version)
# and search the path which contain the libname/header.h (usefull for new version)
# Then we need to include ${FFMPEG_libname_INCLUDE_DIRS}
# (in old version case, use by ffmpeg header and osg plugin code)
# (in new version case, use by ffmpeg header)
# and ${FFMPEG_libname_INCLUDE_DIRS/libname}
# (in new version case, use by osg plugin code)
# Macro to find header and lib directories
# example: FFMPEG_FIND(AVFORMAT avformat avformat.h)
macro(FFMPEG_FIND varname shortname headername) macro(FFMPEG_FIND varname shortname headername)
find_path(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername} find_path(FFMPEG_${varname}_INCLUDE_DIRS lib${shortname}/${headername}
PATHS PATHS
${FFMPEG_ROOT}/include ${FFMPEG_ROOT}/include
@ -68,7 +54,7 @@ FFMPEG_FIND(LIBAVCODEC avcodec avcodec.h)
FFMPEG_FIND(LIBAVCODEC_FFT avcodec avfft.h) FFMPEG_FIND(LIBAVCODEC_FFT avcodec avfft.h)
FFMPEG_FIND(LIBAVUTIL avutil avutil.h) FFMPEG_FIND(LIBAVUTIL avutil avutil.h)
FFMPEG_FIND(LIBSWRESAMPLE swresample swresample.h) FFMPEG_FIND(LIBSWRESAMPLE swresample swresample.h)
FFMPEG_FIND(LIBSWSCALE swscale swscale.h) # Not sure about the header to look for here. FFMPEG_FIND(LIBSWSCALE swscale swscale.h)
set(FFMPEG_FOUND "NO") set(FFMPEG_FOUND "NO")