summaryrefslogtreecommitdiff
path: root/cmake/modules/FindGlib2.cmake
blob: 8b1e21d83b019457977a06c06ce0843a9fef2ed2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FILE(TO_CMAKE_PATH "$ENV{GLIB2_DIR}" TRY1_DIR)
FILE(TO_CMAKE_PATH "${GLIB2_DIR}" TRY2_DIR)
FILE(GLOB GLIB2_DIR ${TRY1_DIR} ${TRY2_DIR})

FIND_PATH(GLIB_glib_2_INCLUDE_DIR glib.h
                                  PATHS ${GLIB2_DIR}/include /usr/local/include /usr/include
                                  ENV INCLUDE DOC "Directory containing glib.h include file")
                           
FIND_PATH(GLIB_glibconfig_2_INCLUDE_DIR glibconfig.h
                                        PATHS ${GLIB2_DIR}/include ${GLIB2_DIR}/lib/include /usr/local/include /usr/include
                                        ENV INCLUDE DOC "Directory containing glibconfig.h include file")                           

FIND_LIBRARY(GLIB_glib_2_LIBRARY NAMES glib-2.0
                                 PATHS ${GLIB2_DIR}/bin ${GLIB2_DIR}/win32/bin ${GLIB2_DIR}/lib ${GLIB2_DIR}/win32/lib /usr/local/lib /usr/lib
                                 ENV LIB
                                 DOC "glib library to link with"
                                 NO_SYSTEM_ENVIRONMENT_PATH)    

FIND_LIBRARY(GLIB_gmodule_2_LIBRARY NAMES gmodule-2.0
                                    PATHS ${GLIB2_DIR}/bin ${GLIB2_DIR}/win32/bin ${GLIB2_DIR}/lib ${GLIB2_DIR}/win32/lib /usr/local/lib /usr/lib
                                    ENV LIB
                                    DOC "gmodule library to link with"
                                    NO_SYSTEM_ENVIRONMENT_PATH)

FIND_LIBRARY(GLIB_gobject_2_LIBRARY NAMES gobject-2.0
                                    PATHS ${GLIB2_DIR}/bin ${GLIB2_DIR}/win32/bin ${GLIB2_DIR}/lib ${GLIB2_DIR}/win32/lib /usr/local/lib /usr/lib
                                    ENV LIB
                                    DOC "gobject library to link with"
                                    NO_SYSTEM_ENVIRONMENT_PATH)

FIND_LIBRARY(GLIB_gthread_2_LIBRARY NAMES gthread-2.0
                                    PATHS ${GLIB2_DIR}/bin ${GLIB2_DIR}/win32/bin ${GLIB2_DIR}/lib ${GLIB2_DIR}/win32/lib /usr/local/lib /usr/lib
                                    ENV LIB
                                    DOC "gthread library to link with"
                                    NO_SYSTEM_ENVIRONMENT_PATH)                                                                

IF (GLIB_glib_2_INCLUDE_DIR AND GLIB_glibconfig_2_INCLUDE_DIR AND GLIB_glib_2_LIBRARY AND GLIB_gmodule_2_LIBRARY AND GLIB_gobject_2_LIBRARY AND GLIB_gthread_2_LIBRARY)
  SET(GLIB2_INCLUDE_DIR ${GLIB_glib_2_INCLUDE_DIR} ${GLIB_glibconfig_2_INCLUDE_DIR})
  list(REMOVE_DUPLICATES GLIB2_INCLUDE_DIR)
  SET(GLIB2_LIBRARIES ${GLIB_glib_2_LIBRARY} ${GLIB_gmodule_2_LIBRARY} ${GLIB_gobject_2_LIBRARY} ${GLIB_gthread_2_LIBRARY})
  list(REMOVE_DUPLICATES GLIB2_LIBRARIES)
  SET(GLIB2_FOUND TRUE)
ENDIF (GLIB_glib_2_INCLUDE_DIR AND GLIB_glibconfig_2_INCLUDE_DIR AND GLIB_glib_2_LIBRARY AND GLIB_gmodule_2_LIBRARY AND GLIB_gobject_2_LIBRARY AND GLIB_gthread_2_LIBRARY)