Add a new QtGstreamerUi library that contains a VideoWidget class, a widget that...
[qtgstreamer:qtgstreamer.git] / cmake / modules / FindGObject.cmake
1 # - Try to find GObject
2 # Once done this will define
3 #
4 #  GOBJECT_FOUND - system has GObject
5 #  GOBJECT_INCLUDE_DIR - the GObject include directory
6 #  GOBJECT_LIBRARIES - the libraries needed to use GObject
7 #  GOBJECT_DEFINITIONS - Compiler switches required for using GObject
8
9 # Copyright (c) 2006, Tim Beaulen <tbscope@gmail.com>
10 # Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org>
11 #
12 # Redistribution and use is allowed according to the terms of the BSD license.
13 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14
15
16 IF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
17    # in cache already
18    SET(GObject_FIND_QUIETLY TRUE)
19 ELSE (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
20    SET(GObject_FIND_QUIETLY FALSE)
21 ENDIF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
22
23 IF (NOT WIN32)
24    FIND_PACKAGE(PkgConfig REQUIRED)
25    # use pkg-config to get the directories and then use these values
26    # in the FIND_PATH() and FIND_LIBRARY() calls
27    PKG_CHECK_MODULES(PKG_GOBJECT2 REQUIRED gobject-2.0)
28    SET(GOBJECT_DEFINITIONS ${PKG_GOBJECT2_CFLAGS})
29 ENDIF (NOT WIN32)
30
31 FIND_PATH(GOBJECT_INCLUDE_DIR gobject/gobject.h
32    PATHS
33    ${PKG_GOBJECT2_INCLUDE_DIRS}
34    /usr/include/glib-2.0/
35    PATH_SUFFIXES glib-2.0
36    )
37
38 FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0
39    PATHS
40    ${PKG_GOBJECT2_LIBRARY_DIRS}
41    )
42 FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0
43    PATHS
44    ${PKG_GOBJECT2_LIBRARY_DIRS}
45    )
46 FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0
47    PATHS
48    ${PKG_GOBJECT2_LIBRARY_DIRS}
49    )
50 FIND_LIBRARY(_GLibs NAMES glib-2.0
51    PATHS
52    ${PKG_GOBJECT2_LIBRARY_DIRS}
53    )
54
55 IF (WIN32)
56 SET (GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs})
57 ELSE (WIN32)
58 SET (GOBJECT_LIBRARIES ${PKG_GOBJECT2_LIBRARIES})
59 ENDIF (WIN32)
60
61 IF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
62    SET(GOBJECT_FOUND TRUE)
63 ELSE (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
64    SET(GOBJECT_FOUND FALSE)
65 ENDIF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
66
67 IF (GOBJECT_FOUND)
68    IF (NOT GObject_FIND_QUIETLY)
69       MESSAGE(STATUS "Found GObject libraries: ${GOBJECT_LIBRARIES}")
70       MESSAGE(STATUS "Found GObject includes : ${GOBJECT_INCLUDE_DIR}")
71    ENDIF (NOT GObject_FIND_QUIETLY)
72 ELSE (GOBJECT_FOUND)
73     IF (GObject_FIND_REQUIRED)
74       MESSAGE(STATUS "Could NOT find GObject")
75     ENDIF(GObject_FIND_REQUIRED)
76 ENDIF (GOBJECT_FOUND)
77
78 MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES)