add some comments
[makneto-zunavac1.git] / CMakeMod / FindGObject.cmake
blob1a1e657f613f5666a824706e80f47aeaeb159025
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)
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)
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)
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
35    )
37 FIND_LIBRARY(_GObjectLibs NAMES gobject-2.0
38    HINTS
39    ${PKG_GOBJECT2_LIBRARY_DIRS}
40    ${PKG_GOBJECT2_LIBDIR}
41    )
42 FIND_LIBRARY(_GModuleLibs NAMES gmodule-2.0
43    HINTS
44    ${PKG_GOBJECT2_LIBRARY_DIRS}
45    ${PKG_GOBJECT2_LIBDIR}
46    )
47 FIND_LIBRARY(_GThreadLibs NAMES gthread-2.0
48    HINTS
49    ${PKG_GOBJECT2_LIBRARY_DIRS}
50    ${PKG_GOBJECT2_LIBDIR}
51    )
52 FIND_LIBRARY(_GLibs NAMES glib-2.0
53    HINTS
54    ${PKG_GOBJECT2_LIBRARY_DIRS}
55    ${PKG_GOBJECT2_LIBDIR}
56    )
58 IF (WIN32)
59 SET (GOBJECT_LIBRARIES ${_GObjectLibs} ${_GModuleLibs} ${_GThreadLibs} ${_GLibs})
60 ELSE (WIN32)
61 SET (GOBJECT_LIBRARIES ${PKG_GOBJECT2_LIBRARIES})
62 ENDIF (WIN32)
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)