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
32 HINTS ${PKG_GOBJECT2_INCLUDE_DIRS} ${PKG_GOBJECT2_INCLUDEDIR}
33 PATHS /usr/include/glib-2.0/
34 PATH_SUFFIXES glib-2.0
37 FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0
39 ${PKG_GOBJECT2_LIBRARY_DIRS}
40 ${PKG_GOBJECT2_LIBDIR}
42 FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0
44 ${PKG_GOBJECT2_LIBRARY_DIRS}
45 ${PKG_GOBJECT2_LIBDIR}
47 FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0
49 ${PKG_GOBJECT2_LIBRARY_DIRS}
50 ${PKG_GOBJECT2_LIBDIR}
52 FIND_LIBRARY(_GLibs NAMES glib-2.0
54 ${PKG_GOBJECT2_LIBRARY_DIRS}
55 ${PKG_GOBJECT2_LIBDIR}
59 SET (GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs})
61 SET (GOBJECT_LIBRARIES ${PKG_GOBJECT2_LIBRARIES})
64 MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES)
66 INCLUDE(FindPackageHandleStandardArgs)
67 FIND_PACKAGE_HANDLE_STANDARD_ARGS(GObject DEFAULT_MSG GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES)