add some comments
[makneto-zunavac1.git] / CMakeMod / FindGLIB2.cmake.old
blob10098c82f022b5de8c4f87fc8983d4ff25a44d73
1 # - Try to find GLIB2
2 # Once done this will define
4 #  GLIB2_FOUND - system has glib2
5 #  GLIB2_INCLUDE_DIR - the glib2 include directory
6 #  GLIB2_LIBRARIES - Link these to use glib2
7 #  GTHREAD2_LIBRARIES - Link these to use gthread2
8 #  GLIB2_DEFINITIONS - Compiler switches required for using glib2
9 # Redistribution and use is allowed according to the terms of the BSD license.
10 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
13 # Copyright (c) 2010, Ni Hui <shuizhuyuanluo@126.com>
15 # Redistribution and use is allowed according to the terms of the BSD license.
16 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
18 if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
19     # in cache already
20     set(GLIB2_FOUND_QUIETLY TRUE)
21 endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES)
23 if(NOT WIN32)
24    find_package(PkgConfig)
25    pkg_check_modules(PKG_GLIB2 glib-2.0)
26    set(GLIB2_DEFINITIONS ${PKG_GLIB2_CFLAGS})
27 endif(NOT WIN32)
29 find_path(GLIB2_MAIN_INCLUDE_DIR NAMES glib.h
30     PATHS
31     ${PKG_GLIB2_INCLUDE_DIRS}
32     PATH_SUFFIXES glib-2.0
35 find_library(GLIB2_LIBRARIES NAMES glib-2.0
36     PATHS
37     ${PKG_GLIB2_LIBRARY_DIRS} ${PKG_GLIB_LIBDIR}
40 find_path(GLIB2_INTERNAL_INCLUDE_DIR NAMES glibconfig.h
41           PATH_SUFFIXES glib-2.0/include ../lib/glib-2.0/include
42           HINTS ${PKG_GLIB_INCLUDE_DIRS} ${PKG_GLIB_LIBRARIES} ${CMAKE_SYSTEM_LIBRARY_PATH})
45 find_library(GTHREAD2_LIBRARIES NAMES gthread-2.0
46     PATHS
47     ${PKG_GLIB2_LIBRARY_DIRS}
50 set(GLIB2_INCLUDE_DIR ${GLIB2_MAIN_INCLUDE_DIR})
52 include(FindPackageHandleStandardArgs)
53 find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_INCLUDE_DIR GLIB2_LIBRARIES GTHREAD2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)
55 mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES GTHREAD2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)