1 # - Try to find GObject
2 # Once done this will define
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
9 # Copyright (c) 2006, Tim Beaulen <tbscope@gmail.com>
10 # Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org>
12 # Redistribution and use is allowed according to the terms of the BSD license.
13 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
16 IF (GOBJECT_INCLUDE_DIR AND GOBJECT_LIBRARIES)
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)
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})
31 FIND_PATH(GOBJECT_INCLUDE_DIR gobject/gobject.h
33 ${PKG_GOBJECT2_INCLUDE_DIRS}
34 /usr/include/glib-2.0/
35 PATH_SUFFIXES glib-2.0
38 FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0
40 ${PKG_GOBJECT2_LIBRARY_DIRS}
42 FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0
44 ${PKG_GOBJECT2_LIBRARY_DIRS}
46 FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0
48 ${PKG_GOBJECT2_LIBRARY_DIRS}
50 FIND_LIBRARY(_GLibs NAMES glib-2.0
52 ${PKG_GOBJECT2_LIBRARY_DIRS}
56 SET (GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs})
58 SET (GOBJECT_LIBRARIES ${PKG_GOBJECT2_LIBRARIES})
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)
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)
73 IF (GObject_FIND_REQUIRED)
74 MESSAGE(STATUS "Could NOT find GObject")
75 ENDIF(GObject_FIND_REQUIRED)
78 MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES)