# - Try to find the GLIB2 libraries

if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES AND GTHREAD2_LIBRARIES)
    # Already in cache, be silent
    set(GLIB2_FIND_QUIETLY TRUE)
endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES AND GTHREAD2_LIBRARIES)

if (NOT WIN32)
   include(FindPkgConfig)
   pkg_search_module(PC_GLIB2 REQUIRED glib-2.0)
   pkg_search_module(PC_GTHREAD2 REQUIRED gthread-2.0)
endif(NOT WIN32)

set(GLIB2_INCLUDE_DIR ${PC_GLIB2_INCLUDE_DIRS})

find_library(GLIB2_LIBRARIES NAMES glib-2.0 HINTS ${PC_GLIB2_LIBDIR} ${PC_GLIB2_LIBRARY_DIRS})

find_library(GTHREAD2_LIBRARIES NAMES gthread-2.0 HINTS ${PC_GTHREAD2_LIBDIR} ${PC_GTHREAD2_LIBRARY_DIRS})


mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES GTHREAD2_LIBRARIES)

