1 # - Try to find gnomevfs2
2 # Find gnomevfs2 headers, libraries and the answer to all questions.
4 # GNOMEVFS2_FOUND True if gnomevfs2 got found
5 # GNOMEVFS2_INCLUDEDIR Location of gnomevfs2 headers
6 # GNOMEVFS2_LIBRARIES List of libaries to use gnomevfs2
7 # GNOMEVFS2_DEFINITIONS Definitions to compile gnomevfs2
9 # Copyright (c) 2007 Juha Tuomala <tuju@iki.fi>
10 # Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
11 # Copyright (c) 2007 Alban Browaeys <prahal@yahoo.com>
13 # Redistribution and use is allowed according to the terms of the New
15 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
18 INCLUDE( FindPkgConfig )
19 # Take care about gnome-vfs-2.0.pc settings
20 IF ( GnomeVfs2_FIND_REQUIRED )
21 SET( _pkgconfig_REQUIRED "REQUIRED" )
22 ELSE ( GnomeVfs2_FIND_REQUIRED )
23 SET( _pkgconfig_REQUIRED "" )
24 ENDIF ( GnomeVfs2_FIND_REQUIRED )
26 pkg_search_module( GNOMEVFS2 ${_pkgconfig_REQUIRED} gnome-vfs-2.0 )
29 # Look for gnomevfs2 include dir and libraries w/o pkgconfig
30 IF ( NOT GNOMEVFS2_FOUND AND NOT PKG_CONFIG_FOUND )
31 FIND_PATH( _gnomevfs2_include_DIR libgnomevfs/gnome-vfs.h PATH_SUFFIXES gnome-vfs-2.0
38 FIND_PATH( _gnomevfs2_filesize_include_DIR gnome-vfs-file-size.h
40 /opt/gnome/lib64/gnome-vfs-2.0/include
41 /opt/gnome/lib/gnome-vfs-2.0/include
42 /opt/lib/gnome-vfs-2.0/include
43 /opt/local/lib/gnome-vfs-2.0/include
44 /sw/lib/gnome-vfs-2.0/include
45 /usr/lib64/gnome-vfs-2.0/include
46 /usr/lib/gnome-vfs-2.0/include
48 FIND_LIBRARY( _gnomevfs2_link_DIR gnomevfs-2
58 IF ( _gnomevfs2_include_DIR AND _gnomevfs2_filesize_include_DIR AND _gnomevfs2_link_DIR )
59 SET ( _gnomevfs2_FOUND TRUE )
60 ENDIF ( _gnomevfs2_include_DIR AND _gnomevfs2_filesize_include_DIR AND _gnomevfs2_link_DIR )
63 IF ( _gnomevfs2_FOUND )
64 SET ( GNOMEVFS2_INCLUDE_DIRS ${_gnomevfs2_include_DIR} ${_gnomevfs2_filesize_include_DIR} )
65 SET ( GNOMEVFS2_LIBRARIES ${_gnomevfs2_link_DIR} )
66 ENDIF ( _gnomevfs2_FOUND )
69 IF ( NOT GCONF2_FOUND )
70 FIND_PACKAGE( GConf2 REQUIRED)
72 SET ( GNOMEVFS2_INCLUDE_DIRS ${GNOMEVFS2_INCLUDE_DIRS} ${GCONF2_INCLUDE_DIRS} )
73 SET ( GNOMEVFS2_LIBRARIES ${GNOMEVFS2_LIBRARIES} ${GCONF2_LIBRARIES} )
74 ENDIF ( GCONF2_FOUND )
75 ENDIF ( NOT GCONF2_FOUND )
76 IF ( NOT GLIB2_FOUND )
77 FIND_PACKAGE( GLIB2 REQUIRED)
80 SET ( GNOMEVFS2_INCLUDE_DIRS ${GNOMEVFS2_INCLUDE_DIRS} ${GTHREAD2_INCLUDE_DIR} )
81 SET ( GNOMEVFS2_LIBRARIES ${GNOMEVFS2_LIBRARIES} ${GTHREAD2_LIBRARY} )
82 ENDIF ( GTHREAD2_FOUND )
84 SET ( GNOMEVFS2_INCLUDE_DIRS ${GNOMEVFS2_INCLUDE_DIRS} ${GMODULE2_INCLUDE_DIR} )
85 SET ( GNOMEVFS2_LIBRARIES ${GNOMEVFS2_LIBRARIES} ${GMODULE2_LIBRARY} )
86 ENDIF ( GMODULE2_FOUND )
88 SET ( GNOMEVFS2_INCLUDE_DIRS ${GNOMEVFS2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIR} )
89 SET ( GNOMEVFS2_LIBRARIES ${GNOMEVFS2_LIBRARIES} ${GOBJECT2_LIBRARY} )
90 ENDIF ( GOBJECT2_FOUND )
92 SET ( GNOMEVFS2_INCLUDE_DIRS ${GNOMEVFS2_INCLUDE_DIRS} ${GLIB2_INCLUDE_DIR} ${GLIBCONFIG_INCLUDE_DIR} )
93 SET ( GNOMEVFS2_LIBRARIES ${GNOMEVFS2_LIBRARIES} ${GLIB2_LIBRARY} )
95 ENDIF ( NOT GLIB2_FOUND )
99 IF ( GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS AND _gnomevfs2_FOUND )
100 SET( GNOMEVFS2_FOUND 1 )
101 IF ( NOT GnomeVfs2_FIND_QUIETLY )
102 MESSAGE( STATUS "Found gnomevfs2: ${GNOMEVFS2_LIBRARIES} ${GNOMEVFS2_INCLUDE_DIRS}" )
103 ENDIF ( NOT GnomeVfs2_FIND_QUIETLY )
104 ELSE ( GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS AND _gnomevfs2_FOUND )
105 IF ( GnomeVfs2_FIND_REQUIRED )
106 MESSAGE( SEND_ERROR "Could NOT find gnomevfs2" )
107 ELSE ( GnomeVfs2_FIND_REQUIRED )
108 IF ( NOT GnomeVfs2_FIND_QUIETLY )
109 MESSAGE( STATUS "Could NOT find gnomevfs2" )
110 ENDIF ( NOT GnomeVfs2_FIND_QUIETLY )
111 ENDIF ( GnomeVfs2_FIND_REQUIRED )
112 ENDIF ( GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS AND _gnomevfs2_FOUND )
114 ENDIF ( NOT GNOMEVFS2_FOUND AND NOT PKG_CONFIG_FOUND )
116 # Hide advanced variables from CMake GUIs
117 MARK_AS_ADVANCED( GNOMEVFS2_LIBRARIES GNOMEVFS2_INCLUDE_DIRS )