]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/include/Modules/FindGTK2.cmake
ManualPaint RangeSlider 50% DFCH
[creaMaracasVisu.git] / lib / maracasVisuLib / include / Modules / FindGTK2.cmake
1
2 IF (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
3   # in cache already
4   SET(GTK2_FOUND TRUE)
5 ELSE (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
6   IF(UNIX)
7     # use pkg-config to get the directories and then use these values
8     # in the FIND_PATH() and FIND_LIBRARY() calls
9     INCLUDE(UsePkgConfig)
10
11     PKGCONFIG(gtk-2.0 _GTK22IncDir _GTK22LinkDir _GTK22LinkFlags _GTK22Cflags)
12
13     FIND_PATH(GTK2_GTK_INCLUDE_PATH gtk/gtk.h
14       $ENV{GTK2_HOME}
15       ${_GTK22IncDir}
16       /usr/include/gtk-2.0
17       /usr/local/include/gtk-2.0
18       /opt/include/gtk-2.0
19       /opt/gnome/include/gtk-2.0
20       /sw/include/gtk-2.0
21     )
22
23     # Some Linux distributions (e.g. Red Hat) have glibconfig.h
24     # and glib.h in different directories, so we need to look
25     # for both.
26     #  - Atanas Georgiev <atanas@cs.columbia.edu>
27     PKGCONFIG(glib-2.0 _GLIB2IncDir _GLIB2inkDir _GLIB2LinkFlags _GLIB2Cflags)
28     PKGCONFIG(gmodule-2.0 _GMODULE2IncDir _GMODULE2inkDir _GMODULE2LinkFlags _GMODULE2Cflags)
29     SET(GDIR /opt/gnome/lib/glib-2.0/include)
30
31     FIND_PATH(GTK2_GLIBCONFIG_INCLUDE_PATH glibconfig.h
32       ${_GLIB2IncDir}
33       /opt/gnome/lib64/glib-2.0/include
34       /opt/gnome/lib/glib-2.0/include
35       /opt/lib/glib-2.0/include
36       /usr/lib64/glib-2.0/include
37       /usr/lib/glib-2.0/include
38       /sw/lib/glib-2.0/include
39     )
40     #MESSAGE(STATUS "DEBUG: GTK2_GLIBCONFIG_INCLUDE_PATH = ${GTK2_GLIBCONFIG_INCLUDE_PATH}")
41
42     FIND_PATH(GTK2_GLIB_INCLUDE_PATH glib.h
43       ${_GLIB2IncDir}
44       /opt/include/glib-2.0
45       /opt/gnome/include/glib-2.0
46       /usr/include/glib-2.0
47       /sw/include/glib-2.0
48     )
49     #MESSAGE(STATUS "DEBUG: GTK2_GLIBCONFIG_INCLUDE_PATH = ${GTK2_GLIBCONFIG_INCLUDE_PATH}")
50
51     FIND_PATH(GTK2_GTKGL_INCLUDE_PATH gtkgl/gtkglarea.h
52       ${_GLIB2IncDir}
53       /usr/include
54       /usr/local/include
55       /usr/openwin/share/include
56       /opt/gnome/include
57       /opt/include
58       /sw/include
59     )
60
61     PKGCONFIG(pango _PANGOIncDir _PANGOinkDir _PANGOLinkFlags _PANGOCflags)
62
63     FIND_PATH(GTK2_PANGO_INCLUDE_PATH pango/pango.h
64       ${_PANGOIncDir}
65       /opt/gnome/include/pango-1.0
66       /opt/include/pango-1.0
67       /usr/include/pango-1.0
68       /sw/include/pango-1.0
69     )
70
71     PKGCONFIG(gdk-2.0 _GDK2IncDir _GDK2inkDir _GDK2LinkFlags _GDK2Cflags)
72
73     FIND_PATH(GTK2_GDKCONFIG_INCLUDE_PATH gdkconfig.h
74       ${_GDK2IncDir}
75       /opt/gnome/lib/gtk-2.0/include
76       /opt/gnome/lib64/gtk-2.0/include
77       /opt/lib/gtk-2.0/include
78       /usr/lib/gtk-2.0/include
79       /usr/lib64/gtk-2.0/include
80       /sw/lib/gtk-2.0/include
81     )
82
83     # Dave:
84     FIND_PATH(GTK2_GDK_INCLUDE_PATH gdk.h
85       ${_GDK2IncDir}
86       /usr/include/gtk-2.0
87       /usr/include/gtk-2.0/gdk
88     )
89     #MESSAGE(STATUS "DEBUG: GTK2_GLIBCONFIG_INCLUDE_PATH = ${GTK2_GLIBCONFIG_INCLUDE_PATH}")
90
91     PKGCONFIG(cairo _CAIROIncDir _CAIROinkDir _CAIROLinkFlags _CAIROCflags)
92
93     FIND_PATH(GTK2_CAIRO_INCLUDE_PATH cairo.h
94       ${_CAIROIncDir}
95       /opt/gnome/include/cairo
96       /usr/include
97       /usr/include/cairo
98       /opt/include
99       /opt/include/cairo
100       /sw/include
101       /sw/include/cairo
102     )
103     #MESSAGE(STATUS "DEBUG: GTK2_CAIRO_INCLUDE_PATH = ${GTK2_CAIRO_INCLUDE_PATH}")
104
105     PKGCONFIG(atk _ATKIncDir _ATKinkDir _ATKLinkFlags _ATKCflags)
106
107     FIND_PATH(GTK2_ATK_INCLUDE_PATH atk/atk.h
108       ${_ATKIncDir}
109       /opt/gnome/include/atk-1.0
110       /usr/include/atk-1.0
111       /opt/include/atk-1.0
112       /sw/include/atk-1.0
113     )
114     #MESSAGE(STATUS "DEBUG: GTK2_ATK_INCLUDE_PATH = ${GTK2_ATK_INCLUDE_PATH}")
115
116     FIND_LIBRARY(GTK2_GTKGL_LIBRARY
117       NAMES
118         gtkgl
119       PATHS
120         ${_GTK22IncDir}
121         /usr/lib
122         /usr/local/lib
123         /usr/openwin/lib
124         /usr/X11R6/lib
125         /opt/gnome/lib
126         /opt/lib
127         /sw/lib
128     )
129
130     FIND_LIBRARY(GTK2_GTK_LIBRARY
131       NAMES
132         gtk-x11-2.0
133       PATHS
134         ${_GTK22LinkDir}
135         /usr/lib
136         /usr/local/lib
137         /usr/openwin/lib
138         /usr/X11R6/lib
139         /opt/gnome/lib
140         /opt/lib
141         /sw/lib
142     )
143
144     FIND_LIBRARY(GTK2_GDK_LIBRARY
145       NAMES
146         gdk-x11-2.0
147       PATHS
148         ${_GDK2LinkDir}
149         /usr/lib
150         /usr/local/lib
151         /usr/openwin/lib
152         /usr/X11R6/lib
153         /opt/gnome/lib
154         /opt/lib
155         /sw/lib
156     )
157
158     FIND_LIBRARY(GTK2_GMODULE_LIBRARY
159       NAMES
160         gmodule-2.0
161       PATHS
162         ${_GMODULE2inkDir}
163         /usr/lib
164         /usr/local/lib
165         /usr/openwin/lib
166         /usr/X11R6/lib
167         /opt/gnome/lib
168         /opt/lib
169         /sw/lib
170     )
171
172     FIND_LIBRARY(GTK2_GLIB_LIBRARY
173       NAMES
174         glib-2.0
175       PATHS
176         ${_GLIB2inkDir}
177         /usr/lib
178         /usr/local/lib
179         /usr/openwin/lib
180         /usr/X11R6/lib
181         /opt/gnome/lib
182         /opt/lib
183         /sw/lib
184     )
185
186     FIND_LIBRARY(GTK2_Xi_LIBRARY 
187       NAMES
188         Xi
189       PATHS 
190         /usr/lib
191         /usr/local/lib
192         /usr/openwin/lib
193         /usr/X11R6/lib
194         /opt/gnome/lib
195         /opt/lib
196         /sw/lib
197     )
198
199     FIND_LIBRARY(GTK2_GTHREAD_LIBRARY
200       NAMES
201         gthread-2.0
202       PATHS
203         /usr/lib
204         /usr/local/lib
205         /usr/openwin/lib
206         /usr/X11R6/lib
207         /opt/gnome/lib
208         /opt/lib
209         /sw/lib
210     )
211
212
213     FIND_LIBRARY(GTK2_GOBJECT_LIBRARY
214       NAMES
215         gobject-2.0
216       PATHS
217         /usr/lib
218         /usr/local/lib
219         /usr/openwin/lib
220         /usr/X11R6/lib
221         /opt/gnome/lib
222         /opt/lib
223         /sw/lib
224     )
225
226     IF(GTK2_GTK_INCLUDE_PATH)
227       IF(GTK2_GLIBCONFIG_INCLUDE_PATH)
228         IF(GTK2_GLIB_INCLUDE_PATH)
229           IF(GTK2_GTK_LIBRARY)
230             IF(GTK2_GLIB_LIBRARY)
231               IF(GTK2_PANGO_INCLUDE_PATH)
232                 IF(GTK2_ATK_INCLUDE_PATH)
233                   IF(GTK2_CAIRO_INCLUDE_PATH)
234                     # Assume that if gtk and glib were found, the other
235                     # supporting libraries have also been found.
236
237                     SET(GTK2_FOUND TRUE)
238
239                     SET(GTK2_INCLUDE_DIRS
240                       ${GTK2_GTK_INCLUDE_PATH}
241                       ${GTK2_GLIBCONFIG_INCLUDE_PATH}
242                       ${GTK2_GLIB_INCLUDE_PATH}
243                       ${GTK2_PANGO_INCLUDE_PATH}
244                       ${GTK2_GDKCONFIG_INCLUDE_PATH}
245                       # Dave:
246                       ${GTK2_GDK_INCLUDE_PATH}
247                       ${GTK2_ATK_INCLUDE_PATH}
248                       ${GTK2_CAIRO_INCLUDE_PATH}
249                     )
250
251                     SET(GTK2_LIBRARIES
252                       ${GTK2_GTK_LIBRARY}
253                       ${GTK2_GDK_LIBRARY}
254                       ${GTK2_GLIB_LIBRARY}
255                     )
256                     #${GTK2_GOBJECT_LIBRARY})
257
258                     IF(GTK2_GMODULE_LIBRARY)
259                       SET(GTK2_LIBRARIES
260                         ${GTK2_LIBRARIES}
261                         ${GTK2_GMODULE_LIBRARY}
262                       )
263                     ENDIF(GTK2_GMODULE_LIBRARY)
264
265                     IF(GTK2_GTHREAD_LIBRARY)
266                       SET(GTK2_LIBRARIES
267                         ${GTK2_LIBRARIES}
268                         ${GTK2_GTHREAD_LIBRARY}
269                       )
270                     SET(GTK2_LIBRARIES ${GTK2_LIBRARIES})
271                     ENDIF(GTK2_GTHREAD_LIBRARY)
272                   ELSE(GTK2_CAIRO_INCLUDE_PATH)
273                     MESSAGE(STATUS "Can not find cairo")
274                   ENDIF(GTK2_CAIRO_INCLUDE_PATH)
275                 ELSE(GTK2_ATK_INCLUDE_PATH)
276                   MESSAGE(STATUS "Can not find atk")
277                 ENDIF(GTK2_ATK_INCLUDE_PATH)
278               ELSE(GTK2_PANGO_INCLUDE_PATH)
279                 MESSAGE(STATUS "Can not find pango includes")
280               ENDIF(GTK2_PANGO_INCLUDE_PATH)
281             ELSE(GTK2_GLIB_LIBRARY)
282               MESSAGE(STATUS "Can not find glib lib")
283             ENDIF(GTK2_GLIB_LIBRARY)
284           ELSE(GTK2_GTK_LIBRARY)
285             MESSAGE(STATUS "Can not find gtk lib")
286           ENDIF(GTK2_GTK_LIBRARY)
287         ELSE(GTK2_GLIB_INCLUDE_PATH)
288           MESSAGE(STATUS "Can not find glib includes")
289         ENDIF(GTK2_GLIB_INCLUDE_PATH)
290       ELSE(GTK2_GLIBCONFIG_INCLUDE_PATH)
291         MESSAGE(STATUS "Can not find glibconfig")
292       ENDIF(GTK2_GLIBCONFIG_INCLUDE_PATH)
293     ELSE (GTK2_GTK_INCLUDE_PATH)
294       MESSAGE(STATUS "Can not find gtk includes")
295     ENDIF (GTK2_GTK_INCLUDE_PATH)
296
297     IF (GTK2_FOUND)
298       IF (NOT GTK2_FIND_QUIETLY)
299         MESSAGE(STATUS "Found GTK2: ${GTK2_LIBRARIES}")
300       ENDIF (NOT GTK2_FIND_QUIETLY)
301     ELSE (GTK2_FOUND)
302       IF (GTK2_FIND_REQUIRED)
303         MESSAGE(SEND_ERROR "Could NOT find GTK2")
304       ENDIF (GTK2_FIND_REQUIRED)
305     ENDIF (GTK2_FOUND)
306
307     MARK_AS_ADVANCED(
308       GTK2_GDK_LIBRARY
309       GTK2_GLIB_INCLUDE_PATH
310       GTK2_GLIB_LIBRARY
311       GTK2_GLIBCONFIG_INCLUDE_PATH
312       GTK2_GMODULE_LIBRARY
313       GTK2_GTHREAD_LIBRARY
314       GTK2_Xi_LIBRARY
315       GTK2_GTK_INCLUDE_PATH
316       GTK2_GTK_LIBRARY
317       GTK2_GTKGL_INCLUDE_PATH
318       GTK2_GTKGL_LIBRARY
319       GTK2_ATK_INCLUDE_PATH
320       GTK2_GDKCONFIG_INCLUDE_PATH
321       # Dave:
322       GTK2_GDK_INCLUDE_PATH
323       #GTK2_GOBJECT_LIBRARY
324       GTK2_PANGO_INCLUDE_PATH
325     )
326   ENDIF(UNIX)
327 ENDIF (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
328