cmake_modules/FindFFMPEG.cmake
author Stepan777 <stepik-777@mail.ru>
Thu, 09 Aug 2012 01:24:38 +0400
changeset 7528 f8cf277dca36
child 7534 ccb9c2906160
permissions -rw-r--r--
FindFFMPEG.cmake (used only for frontend for now). +fix for linux (older version of Qt)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7528
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     1
# - Try to find libxml++-2.6
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     2
# Once done this will define
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     3
#
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     4
#  FFMPEG_FOUND - system has libxml++
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     5
#  FFMPEG_INCLUDE_DIRS - the libxml++ include directory
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     6
#  FFMPEG_LIBRARIES - Link these to use libxml++
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     7
#  FFMPEG_DEFINITIONS - Compiler switches required for using libxml++
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     8
#
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
     9
#  Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    10
#  Modified for other libraries by Lasse Kärkkäinen <tronic>
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    11
#  Modified for Hedgewars by Stepik777
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    12
#
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    13
#  Redistribution and use is allowed according to the terms of the New
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    14
#  BSD license.
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    15
#
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    16
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    17
if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    18
  # in cache already
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    19
  set(FFMPEG_FOUND TRUE)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    20
else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    21
  # use pkg-config to get the directories and then use these values
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    22
  # in the FIND_PATH() and FIND_LIBRARY() calls
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    23
  find_package(PkgConfig)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    24
  if (PKG_CONFIG_FOUND)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    25
    pkg_check_modules(_FFMPEG_AVCODEC libavcodec)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    26
    pkg_check_modules(_FFMPEG_AVFORMAT libavformat)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    27
    pkg_check_modules(_FFMPEG_AVUTIL libavutil)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    28
  endif (PKG_CONFIG_FOUND)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    29
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    30
  find_path(FFMPEG_AVCODEC_INCLUDE_DIR
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    31
    NAMES avcodec.h
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    32
    PATHS ${_FFMPEG_AVCODEC_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    33
    PATH_SUFFIXES ffmpeg libavcodec
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    34
  )
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    35
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    36
  find_path(FFMPEG_AVFORMAT_INCLUDE_DIR
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    37
    NAMES avformat.h
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    38
    PATHS ${_FFMPEG_AVFORMAT_INCLUDE_DIRS} /usr/include /usr/local/include /opt/local/include /sw/include
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    39
    PATH_SUFFIXES ffmpeg libavformat
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    40
  )
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    41
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    42
  find_library(FFMPEG_AVCODEC_LIBRARY
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    43
    NAMES avcodec
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    44
    PATHS ${_FFMPEG_AVCODEC_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    45
  )
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    46
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    47
  find_library(FFMPEG_AVFORMAT_LIBRARY
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    48
    NAMES avformat
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    49
    PATHS ${_FFMPEG_AVFORMAT_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    50
  )
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    51
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    52
  find_library(FFMPEG_AVUTIL_LIBRARY
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    53
    NAMES avutil
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    54
    PATHS ${_FFMPEG_AVUTIL_LIBRARY_DIRS} /usr/lib /usr/local/lib /opt/local/lib /sw/lib
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    55
  )
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    56
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    57
  if (FFMPEG_AVCODEC_LIBRARY AND FFMPEG_AVFORMAT_LIBRARY)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    58
    set(FFMPEG_FOUND TRUE)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    59
  endif (FFMPEG_AVCODEC_LIBRARY AND FFMPEG_AVFORMAT_LIBRARY)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    60
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    61
  if (FFMPEG_FOUND)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    62
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    63
    set(FFMPEG_INCLUDE_DIR
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    64
      ${FFMPEG_AVCODEC_INCLUDE_DIR}
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    65
      ${FFMPEG_AVFORMAT_INCLUDE_DIR}
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    66
    )
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    67
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    68
    set(FFMPEG_LIBRARIES
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    69
      ${FFMPEG_AVCODEC_LIBRARY}
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    70
      ${FFMPEG_AVFORMAT_LIBRARY}
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    71
      ${FFMPEG_AVUTIL_LIBRARY}
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    72
    )
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    73
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    74
  endif (FFMPEG_FOUND)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    75
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    76
  if (FFMPEG_FOUND)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    77
    if (NOT FFMPEG_FIND_QUIETLY)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    78
      message(STATUS "Found FFMPEG: ${FFMPEG_LIBRARIES}")
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    79
    endif (NOT FFMPEG_FIND_QUIETLY)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    80
  else (FFMPEG_FOUND)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    81
    if (FFMPEG_FIND_REQUIRED)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    82
      message(FATAL_ERROR "Could not find FFMPEG libavcodec, libavformat or libswscale")
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    83
    endif (FFMPEG_FIND_REQUIRED)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    84
  endif (FFMPEG_FOUND)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    85
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    86
endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)
f8cf277dca36 FindFFMPEG.cmake (used only for frontend for now).
Stepan777 <stepik-777@mail.ru>
parents:
diff changeset
    87