FindGio.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. # - Try to find Gio
  2. # Once done this will define
  3. #
  4. # GIO_FOUND - system has Gio
  5. # GIO_INCLUDE_DIR - the Gio include directory
  6. # GIO_LIBRARIES - the libraries needed to use Gio
  7. # GIO_DEFINITIONS - Compiler switches required for using Gio
  8. IF (GIO_INCLUDE_DIR AND GIO_LIBRARIES)
  9. # in cache already
  10. SET(Gio_FIND_QUIETLY TRUE)
  11. ELSE (GIO_INCLUDE_DIR AND GIO_LIBRARIES)
  12. SET(Gio_FIND_QUIETLY FALSE)
  13. ENDIF (GIO_INCLUDE_DIR AND GIO_LIBRARIES)
  14. IF (NOT WIN32)
  15. # use pkg-config to get the directories and then use these values
  16. # in the FIND_PATH() and FIND_LIBRARY() calls
  17. FIND_PACKAGE(PkgConfig)
  18. PKG_CHECK_MODULES(GIO gio-2.0)
  19. #MESSAGE(STATUS "DEBUG: Gio include directory = ${GIO_INCLUDE_DIRS}")
  20. #MESSAGE(STATUS "DEBUG: Gio link directory = ${GIO_LIBRARY_DIRS}")
  21. #MESSAGE(STATUS "DEBUG: Gio CFlags = ${GIO_CFLAGS}")
  22. SET(GIO_DEFINITIONS ${GIO_CFLAGS_OTHER})
  23. ENDIF (NOT WIN32)
  24. FIND_PATH(GIO_INCLUDE_DIR gio.h
  25. PATHS
  26. ${GIO_INCLUDEDIR}
  27. ${GIO_INCLUDE_DIRS}
  28. PATH_SUFFIXES glib-2.0/gio/
  29. )
  30. FIND_LIBRARY(_GioLibs NAMES gio-2.0 libgio-2.0
  31. PATHS
  32. ${GIO_LIBDIR}
  33. ${GIO_LIBRARY_DIRS}
  34. )
  35. SET( GIO_LIBRARIES ${_GioLibs} )
  36. SET( GIO_INCLUDE_DIRS ${GIO_INCLUDE_DIR} )
  37. IF (GIO_INCLUDE_DIR AND GIO_LIBRARIES)
  38. SET(GIO_FOUND TRUE)
  39. ELSE (GIO_INCLUDE_DIR AND GIO_LIBRARIES)
  40. SET(GIO_FOUND FALSE)
  41. ENDIF (GIO_INCLUDE_DIR AND GIO_LIBRARIES)
  42. IF (GIO_FOUND)
  43. IF (NOT Gio_FIND_QUIETLY)
  44. MESSAGE(STATUS "Found Gio libraries: ${GIO_LIBRARIES}")
  45. MESSAGE(STATUS "Found Gio includes : ${GIO_INCLUDE_DIR}")
  46. ENDIF (NOT Gio_FIND_QUIETLY)
  47. ELSE (GIO_FOUND)
  48. IF (Gio_FIND_REQUIRED)
  49. MESSAGE(STATUS "Could NOT find Gio")
  50. ENDIF(Gio_FIND_REQUIRED)
  51. ENDIF (GIO_FOUND)
  52. MARK_AS_ADVANCED(GIO_INCLUDE_DIR _GioLibs)