1 # - Try to find GnomeVFS2
2 # Once done this will define
3 #
4 # GNOMEVFS2_FOUND - system has GnomeVFS2
5 # GNOMEVFS2_INCLUDE_DIRS - the GnomeVFS2 include directory
6 # GNOMEVFS2_LIBRARIES - Link these to use GnomeVFS2
7 # GNOMEVFS2_DEFINITIONS - Compiler switches required for using GnomeVFS2
8 #
9 # Copyright (c) 2008 Joshua L. Blocher <verbalshadow@gmail.com>
10 #
11 # Redistribution and use is allowed according to the terms of the New
12 # BSD license.
13 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14 #
17 if (GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS)
18 # in cache already
19 set(GNOMEVFS2_FOUND TRUE)
20 else (GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS)
21 # use pkg-config to get the directories and then use these values
22 # in the FIND_PATH() and FIND_LIBRARY() calls
23 if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
24 include(UsePkgConfig)
25 pkgconfig(gnome-vfs-2.0 _GNOMEVFS2_INCLUDEDIR _GNOMEVFS2_LIBDIR _GNOMEVFS2_LDFLAGS _GNOMEVFS2_CFLAGS)
26 else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
27 find_package(PkgConfig)
28 if (PKG_CONFIG_FOUND)
29 pkg_check_modules(_GNOMEVFS2 gnome-vfs-2.0)
30 endif (PKG_CONFIG_FOUND)
31 endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
32 find_path(GNOMEVFS2_INCLUDE_DIR
33 NAMES
34 libgnomevfs/gnome-vfs.h
35 PATHS
36 ${_GNOMEVFS2_INCLUDEDIR}
37 /usr/include
38 /usr/local/include
39 /opt/local/include
40 /sw/include
41 $ENV{DEVLIBS_PATH}//include//
42 PATH_SUFFIXES
43 gnome-vfs-2.0
44 )
46 find_library(GNOMEVFS-2_LIBRARY
47 NAMES
48 gnomevfs-2
49 PATHS
50 ${_GNOMEVFS2_LIBDIR}
51 /usr/lib
52 /usr/local/lib
53 /opt/local/lib
54 /sw/lib
55 )
57 if (GNOMEVFS-2_LIBRARY)
58 set(GNOMEVFS-2_FOUND TRUE)
59 endif (GNOMEVFS-2_LIBRARY)
61 set(GNOMEVFS2_INCLUDE_DIRS
62 ${GNOMEVFS2_INCLUDE_DIR}
63 )
65 if (GNOMEVFS-2_FOUND)
66 set(GNOMEVFS2_LIBRARIES
67 ${GNOMEVFS2_LIBRARIES}
68 ${GNOMEVFS-2_LIBRARY}
69 )
70 endif (GNOMEVFS-2_FOUND)
72 if (GNOMEVFS2_INCLUDE_DIRS AND GNOMEVFS2_LIBRARIES)
73 set(GNOMEVFS2_FOUND TRUE)
74 endif (GNOMEVFS2_INCLUDE_DIRS AND GNOMEVFS2_LIBRARIES)
76 if (GNOMEVFS2_FOUND)
77 if (NOT GnomeVFS2_FIND_QUIETLY)
78 message(STATUS "Found GnomeVFS2: ${GNOMEVFS2_LIBRARIES}")
79 endif (NOT GnomeVFS2_FIND_QUIETLY)
80 else (GNOMEVFS2_FOUND)
81 if (GnomeVFS2_FIND_REQUIRED)
82 message(FATAL_ERROR "Could not find GnomeVFS2")
83 endif (GnomeVFS2_FIND_REQUIRED)
84 endif (GNOMEVFS2_FOUND)
86 # show the GNOMEVFS2_INCLUDE_DIRS and GNOMEVFS2_LIBRARIES variables only in the advanced view
87 mark_as_advanced(GNOMEVFS2_INCLUDE_DIRS GNOMEVFS2_LIBRARIES)
89 endif (GNOMEVFS2_LIBRARIES AND GNOMEVFS2_INCLUDE_DIRS)