]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/include/Modules/FindGLIB.cmake
creaMaracasVisu Library
[creaMaracasVisu.git] / lib / maracasVisuLib / include / Modules / FindGLIB.cmake
1 #
2 # This module finds if GLIB is installed and determines where the
3 # include files and libraries are. It also determines what the name of
4 # the library is. This code sets the following variables:
5 #
6 #  GLIB_FOUND           = system has GLIB and it should be used
7 #  GLIB_LIBRARIES       = full path to the GLIB library and linker flags on unix
8 #  CMAKE_GLIB_CXX_FLAGS = compiler flags for building GLIB 
9 #  GLIB_INCLUDE_DIR     = include path of GLIB
10
11 IF(WIN32)
12   IF(CYGWIN)
13
14     FIND_PROGRAM(CMAKE_GLIB_CONFIG glib-config ../glib/bin ../../glib/bin)
15     SET(CMAKE_GLIB_CXX_FLAGS "`${CMAKE_GLIB_CONFIG} --cflags`")
16     SET(GLIB_LIBRARIES "`${CMAKE_GLIB_CONFIG} --libs`")
17
18   ELSE(CYGWIN)
19
20     SET (GLIB_POSSIBLE_PATHS
21       $ENV{GLIB}/src/glib
22       $ENV{CREATIS}/glib-1.3/src/glib
23       "C:/glib-1.3/src/glib"
24     )
25     FIND_LIBRARY(GLIB_SHARED_LIBRARY
26       NAMES glib-1.3
27       PATHS ${GLIB_POSSIBLE_PATHS} 
28     )
29
30     FIND_PATH(GLIB_INCLUDE_DIR
31       glib.h
32       ${GLIB_POSSIBLE_PATHS} 
33     )
34
35   ENDIF(CYGWIN)
36 ELSE(WIN32)
37
38   FIND_PROGRAM(CMAKE_GLIB_CONFIG glib-config ../glib/bin ../../glib/bin)
39   SET(CMAKE_GLIB_CXX_FLAGS "`${CMAKE_GLIB_CONFIG} --cflags`")
40   SET(GLIB_LIBRARIES "`${CMAKE_GLIB_CONFIG} --libs`")
41
42 ENDIF(WIN32)
43
44 MARK_AS_ADVANCED(
45   GLIB_SHARED_LIBRARY
46   CMAKE_GLIB_CONFIG
47   CMAKE_GLIB_CXX_FLAGS
48   GLIB_INCLUDE_DIR
49 )
50
51 IF(GLIB_LIBRARIES)
52   IF(GLIB_INCLUDE_DIR OR CMAKE_GLIB_CXX_FLAGS)
53     SET(CMAKE_GLIB_CAN_COMPILE 1)
54     SET(GLIB_FOUND 1)
55   ENDIF(GLIB_INCLUDE_DIR OR CMAKE_GLIB_CXX_FLAGS)
56 ENDIF(GLIB_LIBRARIES)
57