1 # - Try to find GObject2
2 # Find GObject2 headers, libraries and the answer to all questions.
4 # GOBJECT2_FOUND True if GOBJECT2 got found
5 # GOBJECT2_INCLUDE_DIRS Location of GOBJECT2 headers
6 # GOBJECT2_LIBRARIES List of libraries to use GOBJECT2
8 # Copyright (c) 2008 Bjoern Ricks <bjoern.ricks@googlemail.com>
10 # Redistribution and use is allowed according to the terms of the New
12 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
15 INCLUDE( FindPkgConfig )
17 IF ( GOBJECT2_FIND_REQUIRED )
18 SET( _pkgconfig_REQUIRED "REQUIRED" )
19 ELSE( GOBJECT2_FIND_REQUIRED )
20 SET( _pkgconfig_REQUIRED "" )
21 ENDIF ( GOBJECT2_FIND_REQUIRED )
23 IF ( GOBJECT2_MIN_VERSION )
24 PKG_SEARCH_MODULE( GOBJECT2 ${_pkgconfig_REQUIRED} gobject-2.0>=${GOBJECT2_MIN_VERSION} )
25 ELSE ( GOBJECT2_MIN_VERSION )
26 PKG_SEARCH_MODULE( GOBJECT2 ${_pkgconfig_REQUIRED} gobject-2.0 )
27 ENDIF ( GOBJECT2_MIN_VERSION )
30 IF( NOT GOBJECT2_FOUND AND NOT PKG_CONFIG_FOUND )
31 FIND_PATH( GOBJECT2_INCLUDE_DIRS gobject/gobject.h PATH_SUFFIXES glib-2.0)
32 FIND_LIBRARY( GOBJECT2_LIBRARIES gobject-2.0 )
35 IF ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS )
36 SET( GOBJECT2_FOUND 1 )
37 IF ( NOT GOBJECT2_FIND_QUIETLY )
38 MESSAGE( STATUS "Found GOBJECT2: ${GOBJECT2_LIBRARIES}" )
39 ENDIF ( NOT GOBJECT2_FIND_QUIETLY )
40 ELSE ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS )
41 IF ( GOBJECT2_FIND_REQUIRED )
42 MESSAGE( SEND_ERROR "Could NOT find GOBJECT2" )
43 ELSE ( GOBJECT2_FIND_REQUIRED )
44 IF ( NOT GOBJECT2_FIND_QUIETLY )
45 MESSAGE( STATUS "Could NOT find GOBJECT2" )
46 ENDIF ( NOT GOBJECT2_FIND_QUIETLY )
47 ENDIF ( GOBJECT2_FIND_REQUIRED )
48 ENDIF ( GOBJECT2_LIBRARIES AND GOBJECT2_INCLUDE_DIRS )
49 ENDIF( NOT GOBJECT2_FOUND AND NOT PKG_CONFIG_FOUND )
51 MARK_AS_ADVANCED( GOBJECT2_LIBRARIES GOBJECT2_INCLUDE_DIRS )