Imported Upstream version 2.8.10.2
[platform/upstream/cmake.git] / Modules / FindGTK.cmake
1 # - try to find GTK (and glib) and GTKGLArea
2 #  GTK_INCLUDE_DIR   - Directories to include to use GTK
3 #  GTK_LIBRARIES     - Files to link against to use GTK
4 #  GTK_FOUND         - GTK was found
5 #  GTK_GL_FOUND      - GTK's GL features were found
6
7 #=============================================================================
8 # Copyright 2001-2009 Kitware, Inc.
9 #
10 # Distributed under the OSI-approved BSD License (the "License");
11 # see accompanying file Copyright.txt for details.
12 #
13 # This software is distributed WITHOUT ANY WARRANTY; without even the
14 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 # See the License for more information.
16 #=============================================================================
17 # (To distribute this file outside of CMake, substitute the full
18 #  License text for the above reference.)
19
20 # don't even bother under WIN32
21 if(UNIX)
22
23   find_path( GTK_gtk_INCLUDE_PATH NAMES gtk/gtk.h
24     PATH_SUFFIXES gtk-1.2 gtk12
25     PATHS
26     /usr/openwin/share/include
27     /usr/openwin/include
28     /opt/gnome/include
29   )
30
31   # Some Linux distributions (e.g. Red Hat) have glibconfig.h
32   # and glib.h in different directories, so we need to look
33   # for both.
34   #  - Atanas Georgiev <atanas@cs.columbia.edu>
35
36   find_path( GTK_glibconfig_INCLUDE_PATH NAMES glibconfig.h
37     PATHS
38     /usr/openwin/share/include
39     /usr/local/include/glib12
40     /usr/lib/glib/include
41     /usr/local/lib/glib/include
42     /opt/gnome/include
43     /opt/gnome/lib/glib/include
44   )
45
46   find_path( GTK_glib_INCLUDE_PATH NAMES glib.h
47     PATH_SUFFIXES gtk-1.2 glib-1.2 glib12
48     PATHS
49     /usr/openwin/share/include
50     /usr/lib/glib/include
51     /opt/gnome/include
52   )
53
54   find_path( GTK_gtkgl_INCLUDE_PATH NAMES gtkgl/gtkglarea.h
55     PATHS /usr/openwin/share/include
56           /opt/gnome/include
57   )
58
59   find_library( GTK_gtkgl_LIBRARY gtkgl
60     /usr/openwin/lib
61     /opt/gnome/lib
62   )
63
64   #
65   # The 12 suffix is thanks to the FreeBSD ports collection
66   #
67
68   find_library( GTK_gtk_LIBRARY
69     NAMES  gtk gtk12
70     PATHS /usr/openwin/lib
71           /opt/gnome/lib
72   )
73
74   find_library( GTK_gdk_LIBRARY
75     NAMES  gdk gdk12
76     PATHS  /usr/openwin/lib
77            /opt/gnome/lib
78   )
79
80   find_library( GTK_gmodule_LIBRARY
81     NAMES  gmodule gmodule12
82     PATHS  /usr/openwin/lib
83            /opt/gnome/lib
84   )
85
86   find_library( GTK_glib_LIBRARY
87     NAMES  glib glib12
88     PATHS  /usr/openwin/lib
89            /opt/gnome/lib
90   )
91
92   find_library( GTK_Xi_LIBRARY
93     NAMES Xi
94     PATHS /usr/openwin/lib
95           /opt/gnome/lib
96     )
97
98   find_library( GTK_gthread_LIBRARY
99     NAMES  gthread gthread12
100     PATHS  /usr/openwin/lib
101            /opt/gnome/lib
102   )
103
104   if(GTK_gtk_INCLUDE_PATH
105      AND GTK_glibconfig_INCLUDE_PATH
106      AND GTK_glib_INCLUDE_PATH
107      AND GTK_gtk_LIBRARY
108      AND GTK_glib_LIBRARY)
109
110     # Assume that if gtk and glib were found, the other
111     # supporting libraries have also been found.
112
113     set( GTK_FOUND "YES" )
114     set( GTK_INCLUDE_DIR  ${GTK_gtk_INCLUDE_PATH}
115                            ${GTK_glibconfig_INCLUDE_PATH}
116                            ${GTK_glib_INCLUDE_PATH} )
117     set( GTK_LIBRARIES  ${GTK_gtk_LIBRARY}
118                         ${GTK_gdk_LIBRARY}
119                         ${GTK_glib_LIBRARY} )
120
121     if(GTK_gmodule_LIBRARY)
122       set(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gmodule_LIBRARY})
123     endif()
124     if(GTK_gthread_LIBRARY)
125       set(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gthread_LIBRARY})
126     endif()
127     if(GTK_Xi_LIBRARY)
128       set(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_Xi_LIBRARY})
129     endif()
130
131     if(GTK_gtkgl_INCLUDE_PATH AND GTK_gtkgl_LIBRARY)
132       set( GTK_GL_FOUND "YES" )
133       set( GTK_INCLUDE_DIR  ${GTK_INCLUDE_DIR}
134                             ${GTK_gtkgl_INCLUDE_PATH} )
135       set( GTK_LIBRARIES  ${GTK_gtkgl_LIBRARY} ${GTK_LIBRARIES} )
136       mark_as_advanced(
137         GTK_gtkgl_LIBRARY
138         GTK_gtkgl_INCLUDE_PATH
139         )
140     endif()
141
142   endif()
143
144   mark_as_advanced(
145     GTK_gdk_LIBRARY
146     GTK_glib_INCLUDE_PATH
147     GTK_glib_LIBRARY
148     GTK_glibconfig_INCLUDE_PATH
149     GTK_gmodule_LIBRARY
150     GTK_gthread_LIBRARY
151     GTK_Xi_LIBRARY
152     GTK_gtk_INCLUDE_PATH
153     GTK_gtk_LIBRARY
154     GTK_gtkgl_INCLUDE_PATH
155     GTK_gtkgl_LIBRARY
156   )
157
158 endif()
159
160
161