Add a new QtGstreamerUi library that contains a VideoWidget class, a widget that...
[qtgstreamer:qtgstreamer.git] / cmake / modules / FindGStreamer.cmake
1 # - Try to find GStreamer
2 # Once done this will define
3 #
4 #  GSTREAMER_FOUND - system has GStreamer
5 #  GSTREAMER_INCLUDE_DIR - the GStreamer include directory
6 #  GSTREAMER_LIBRARIES - the libraries needed to use GStreamer
7 #  GSTREAMER_DEFINITIONS - Compiler switches required for using GStreamer
8 #  GSTREAMER_VERSION - the version of GStreamer
9
10 # Copyright (c) 2006, Tim Beaulen <tbscope@gmail.com>
11 # Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org>
12 #
13 # Redistribution and use is allowed according to the terms of the BSD license.
14 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
15
16 # TODO: Other versions --> GSTREAMER_X_Y_FOUND (Example: GSTREAMER_0_8_FOUND and GSTREAMER_0_10_FOUND etc)
17
18 IF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY)
19    # in cache already
20    SET(GStreamer_FIND_QUIETLY TRUE)
21 ELSE (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY)
22    SET(GStreamer_FIND_QUIETLY FALSE)
23 ENDIF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY)
24
25 IF (NOT WIN32)
26    FIND_PACKAGE(PkgConfig REQUIRED)
27    # use pkg-config to get the directories and then use these values
28    # in the FIND_PATH() and FIND_LIBRARY() calls
29    # don't make this check required - otherwise you can't use macro_optional_find_package on this one
30    PKG_CHECK_MODULES(PKG_GSTREAMER gstreamer-0.10)
31    SET(GSTREAMER_VERSION ${PKG_GSTREAMER_VERSION})
32    SET(GSTREAMER_DEFINITIONS ${PKG_GSTREAMER_CFLAGS})
33 ENDIF (NOT WIN32)
34
35 FIND_PATH(GSTREAMER_INCLUDE_DIR gst/gst.h
36    PATHS
37    ${PKG_GSTREAMER_INCLUDE_DIRS}
38    PATH_SUFFIXES gstreamer-0.10
39    )
40
41 FIND_LIBRARY(GSTREAMER_LIBRARIES NAMES gstreamer-0.10
42    PATHS
43    ${PKG_GSTREAMER_LIBRARY_DIRS}
44    )
45
46 FIND_LIBRARY(GSTREAMER_BASE_LIBRARY NAMES gstbase-0.10
47    PATHS
48    ${PKG_GSTREAMER_LIBRARY_DIRS}
49    )
50
51 FIND_LIBRARY(GSTREAMER_INTERFACE_LIBRARY NAMES gstinterfaces-0.10
52    PATHS
53    ${PKG_GSTREAMER_LIBRARY_DIRS}
54    )
55
56 IF (GSTREAMER_INCLUDE_DIR)
57 ELSE (GSTREAMER_INCLUDE_DIR)
58    MESSAGE(STATUS "GStreamer: WARNING: include dir not found")
59 ENDIF (GSTREAMER_INCLUDE_DIR)
60
61 IF (GSTREAMER_LIBRARIES)
62 ELSE (GSTREAMER_LIBRARIES)
63    MESSAGE(STATUS "GStreamer: WARNING: library not found")
64 ENDIF (GSTREAMER_LIBRARIES)
65
66 IF (GSTREAMER_INTERFACE_LIBRARY)
67 ELSE (GSTREAMER_INTERFACE_LIBRARY)
68    MESSAGE(STATUS "GStreamer: WARNING: interface library not found")
69 ENDIF (GSTREAMER_INTERFACE_LIBRARY)
70
71 INCLUDE(FindPackageHandleStandardArgs)
72 FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer  DEFAULT_MSG  GSTREAMER_LIBRARIES GSTREAMER_INCLUDE_DIR GSTREAMER_BASE_LIBRARY GSTREAMER_INTERFACE_LIBRARY)
73
74 MARK_AS_ADVANCED(GSTREAMER_INCLUDE_DIR GSTREAMER_LIBRARIES GSTREAMER_BASE_LIBRARY GSTREAMER_INTERFACE_LIBRARY)