Add a new QtGstreamerUi library that contains a VideoWidget class, a widget that...
[qtgstreamer:qtgstreamer.git] / cmake / modules / FindGLIB2.cmake
1 # - Try to find the GLIB2 libraries
2 # Once done this will define
3 #
4 #  GLIB2_FOUND - system has glib2
5 #  GLIB2_INCLUDE_DIR - the glib2 include directory
6 #  GLIB2_LIBRARIES - glib2 library
7
8 # Copyright (c) 2008 Laurent Montel, <montel@kde.org>
9 #
10 # Redistribution and use is allowed according to the terms of the BSD license.
11 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
12
13
14 if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
15     # Already in cache, be silent
16     set(GLIB2_FIND_QUIETLY TRUE)
17 endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
18
19 if (NOT WIN32)
20    find_package(PkgConfig REQUIRED)
21    pkg_check_modules(PKG_GLIB REQUIRED glib-2.0)
22 endif(NOT WIN32)
23
24 find_path(GLIB2_MAIN_INCLUDE_DIR glib.h
25           PATH_SUFFIXES glib-2.0
26           PATHS ${PKG_GLIB_INCLUDE_DIRS} )
27
28 # search the glibconfig.h include dir under the same root where the library is found
29 find_library(GLIB2_LIBRARIES
30              NAMES glib-2.0
31              PATHS ${PKG_GLIB_LIBRARY_DIRS} )
32
33 find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h
34           PATH_SUFFIXES glib-2.0/include ../lib/glib-2.0/include
35           PATHS ${PKG_GLIB_INCLUDE_DIRS} ${PKG_GLIB_LIBRARIES} ${CMAKE_SYSTEM_LIBRARY_PATH})
36
37 set(GLIB2_INCLUDE_DIR ${GLIB2_MAIN_INCLUDE_DIR})
38
39 # not sure if this include dir is optional or required
40 # for now it is optional
41 if(GLIB2_INTERNAL_INCLUDE_DIR)
42   set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} ${GLIB2_INTERNAL_INCLUDE_DIR})
43 endif(GLIB2_INTERNAL_INCLUDE_DIR)
44
45 include(FindPackageHandleStandardArgs)
46 find_package_handle_standard_args(GLIB2  DEFAULT_MSG  GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)
47
48 mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES)