cmake_modules/FindFFMPEG.cmake
changeset 7538 2d6e69b392cb
parent 7534 ccb9c2906160
child 7540 cc6c656f70b5
equal deleted inserted replaced
7536:e1b80da69991 7538:2d6e69b392cb
     2 # Once done this will define
     2 # Once done this will define
     3 #
     3 #
     4 #  FFMPEG_FOUND - system has ffmpeg
     4 #  FFMPEG_FOUND - system has ffmpeg
     5 #  FFMPEG_INCLUDE_DIR - the ffmpeg include directory
     5 #  FFMPEG_INCLUDE_DIR - the ffmpeg include directory
     6 #  FFMPEG_LIBRARIES - Link these to use ffmpeg
     6 #  FFMPEG_LIBRARIES - Link these to use ffmpeg
       
     7 #  FFMPEG_LIBAVCODEC
       
     8 #  FFMPEG_LIBAVFORMAT
       
     9 #  FFMPEG_LIBAVUTIL
     7 #
    10 #
     8 #  Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
    11 #  Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
     9 #  Modified for other libraries by Lasse Kärkkäinen <tronic>
    12 #  Modified for other libraries by Lasse Kärkkäinen <tronic>
    10 #  Modified for Hedgewars by Stepik777
    13 #  Modified for Hedgewars by Stepik777
    11 #
    14 #
    30     NAMES libavcodec/avcodec.h
    33     NAMES libavcodec/avcodec.h
    31     PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include
    34     PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include
    32     PATH_SUFFIXES ffmpeg libav
    35     PATH_SUFFIXES ffmpeg libav
    33   )
    36   )
    34 
    37 
    35   find_library(FFMPEG_AVCODEC_LIBRARY
    38   find_library(FFMPEG_LIBAVCODEC
    36     NAMES avcodec
    39     NAMES avcodec
    37     PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
    40     PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
    38   )
    41   )
    39 
    42 
    40   find_library(FFMPEG_AVFORMAT_LIBRARY
    43   find_library(FFMPEG_LIBAVFORMAT
    41     NAMES avformat
    44     NAMES avformat
    42     PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
    45     PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
    43   )
    46   )
    44 
    47 
    45   find_library(FFMPEG_AVUTIL_LIBRARY
    48   find_library(FFMPEG_LIBAVUTIL
    46     NAMES avutil
    49     NAMES avutil
    47     PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
    50     PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
    48   )
    51   )
    49 
    52 
    50   if (FFMPEG_AVCODEC_LIBRARY AND FFMPEG_AVFORMAT_LIBRARY)
    53   if (FFMPEG_LIBAVCODEC AND FFMPEG_LIBAVFORMAT)
    51     set(FFMPEG_FOUND TRUE)
    54     set(FFMPEG_FOUND TRUE)
    52   endif (FFMPEG_AVCODEC_LIBRARY AND FFMPEG_AVFORMAT_LIBRARY)
    55   endif()
    53 
    56 
    54   if (FFMPEG_FOUND)
    57   if (FFMPEG_FOUND)
    55     set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR}/..)
    58     set(FFMPEG_INCLUDE_DIR ${FFMPEG_AVCODEC_INCLUDE_DIR}/..)
    56 
    59 
    57     set(FFMPEG_LIBRARIES
    60     set(FFMPEG_LIBRARIES
    58       ${FFMPEG_AVCODEC_LIBRARY}
    61       ${FFMPEG_LIBAVCODEC}
    59       ${FFMPEG_AVFORMAT_LIBRARY}
    62       ${FFMPEG_LIBAVFORMAT}
    60       ${FFMPEG_AVUTIL_LIBRARY}
    63       ${FFMPEG_LIBAVUTIL}
    61     )
    64     )
    62 
    65 
    63   endif (FFMPEG_FOUND)
    66   endif (FFMPEG_FOUND)
    64 
    67 
    65   if (FFMPEG_FOUND)
    68   if (FFMPEG_FOUND)
    66     if (NOT FFMPEG_FIND_QUIETLY)
    69     if (NOT FFMPEG_FIND_QUIETLY)
    67       message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES} ${FFMPEG_INCLUDE_DIR}")
    70       message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES} ${FFMPEG_INCLUDE_DIR}")
    68     endif (NOT FFMPEG_FIND_QUIETLY)
    71     endif (NOT FFMPEG_FIND_QUIETLY)
    69   else (FFMPEG_FOUND)
    72   else (FFMPEG_FOUND)
    70     if (FFMPEG_FIND_REQUIRED)
    73     if (FFMPEG_FIND_REQUIRED)
    71       message(FATAL_ERROR "Could not find FFMPEG libavcodec, libavformat or libswscale")
    74       message(FATAL_ERROR "Could not find FFMPEG libavcodec or libavformat or libavutil")
    72     endif (FFMPEG_FIND_REQUIRED)
    75     endif (FFMPEG_FIND_REQUIRED)
    73   endif (FFMPEG_FOUND)
    76   endif (FFMPEG_FOUND)
    74 
    77 
    75 endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
    78 endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIR)
    76 
    79