2 # try to find GTK2 (and glib) and GTK2GLArea
4 # GTK2_INCLUDE_DIRS - Directories to include to use GTK2
5 # GTK2_LIBRARIES - Files to link against to use GTK2
6 # GTK2_FOUND - If false, don't try to use GTK2
7 # GTK2_GL_FOUND - If false, don't try to use GTK2's GL features
9 ###################################################################
11 # Copyright (c) 2004 Jan Woetzel
12 # Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
14 # This program is free software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; either version 2
17 # of the License, or (at your option) any later version.
19 # This program is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU General Public License for more details.
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write to the Free Software
26 # Foundation, Inc., 51 Franklin Street, Fifth Floor,
27 # Boston, MA 02110-1301, USA.
29 ###################################################################
31 # Copyright (c) 2004 Jan Woetzel
32 # Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
33 # All rights reserved.
35 # Redistribution and use in source and binary forms, with or without
36 # modification, are permitted provided that the following conditions
39 # * Redistributions of source code must retain the above copyright
40 # notice, this list of conditions and the following disclaimer.
42 # * Redistributions in binary form must reproduce the above copyright
43 # notice, this list of conditions and the following disclaimer in
44 # the documentation and/or other materials provided with the
47 # * Neither the name of the <ORGANIZATION> nor the names of its
48 # contributors may be used to endorse or promote products derived
49 # from this software without specific prior written permission.
51 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
52 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
53 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
54 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
55 # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
56 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
57 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
58 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
59 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
61 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
62 # POSSIBILITY OF SUCH DAMAGE.
65 IF (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
68 ELSE (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
70 # use pkg-config to get the directories and then use these values
71 # in the FIND_PATH() and FIND_LIBRARY() calls
74 PKGCONFIG(gtk+-2.0 _GTK22IncDir _GTK22LinkDir _GTK22LinkFlags _GTK22Cflags)
76 FIND_PATH(GTK2_GTK_INCLUDE_PATH gtk/gtk.h
80 /usr/local/include/gtk-2.0
82 /opt/gnome/include/gtk-2.0
86 # Some Linux distributions (e.g. Red Hat) have glibconfig.h
87 # and glib.h in different directories, so we need to look
89 # - Atanas Georgiev <atanas@cs.columbia.edu>
90 PKGCONFIG(glib-2.0 _GLIB2IncDir _GLIB2inkDir _GLIB2LinkFlags _GLIB2Cflags)
91 PKGCONFIG(gmodule-2.0 _GMODULE2IncDir _GMODULE2inkDir _GMODULE2LinkFlags _GMODULE2Cflags)
92 SET(GDIR /opt/gnome/lib/glib-2.0/include)
94 FIND_PATH(GTK2_GLIBCONFIG_INCLUDE_PATH glibconfig.h
96 /opt/gnome/lib64/glib-2.0/include
97 /opt/gnome/lib/glib-2.0/include
98 /opt/lib/glib-2.0/include
99 /usr/lib64/glib-2.0/include
100 /usr/lib/glib-2.0/include
101 /sw/lib/glib-2.0/include
103 #MESSAGE(STATUS "DEBUG: GTK2_GLIBCONFIG_INCLUDE_PATH = ${GTK2_GLIBCONFIG_INCLUDE_PATH}")
105 FIND_PATH(GTK2_GLIB_INCLUDE_PATH glib.h
107 /opt/include/glib-2.0
108 /opt/gnome/include/glib-2.0
109 /usr/include/glib-2.0
112 #MESSAGE(STATUS "DEBUG: GTK2_GLIBCONFIG_INCLUDE_PATH = ${GTK2_GLIBCONFIG_INCLUDE_PATH}")
114 FIND_PATH(GTK2_GTKGL_INCLUDE_PATH gtkgl/gtkglarea.h
118 /usr/openwin/share/include
124 PKGCONFIG(pango _PANGOIncDir _PANGOinkDir _PANGOLinkFlags _PANGOCflags)
126 FIND_PATH(GTK2_PANGO_INCLUDE_PATH pango/pango.h
128 /opt/gnome/include/pango-1.0
129 /opt/include/pango-1.0
130 /usr/include/pango-1.0
131 /sw/include/pango-1.0
134 PKGCONFIG(gdk-2.0 _GDK2IncDir _GDK2inkDir _GDK2LinkFlags _GDK2Cflags)
136 FIND_PATH(GTK2_GDKCONFIG_INCLUDE_PATH gdkconfig.h
138 /opt/gnome/lib/gtk-2.0/include
139 /opt/gnome/lib64/gtk-2.0/include
140 /opt/lib/gtk-2.0/include
141 /usr/lib/gtk-2.0/include
142 /usr/lib64/gtk-2.0/include
143 /sw/lib/gtk-2.0/include
146 PKGCONFIG(cairo _CAIROIncDir _CAIROinkDir _CAIROLinkFlags _CAIROCflags)
148 FIND_PATH(GTK2_CAIRO_INCLUDE_PATH cairo.h
150 /opt/gnome/include/cairo
158 #MESSAGE(STATUS "DEBUG: GTK2_CAIRO_INCLUDE_PATH = ${GTK2_CAIRO_INCLUDE_PATH}")
160 PKGCONFIG(atk _ATKIncDir _ATKinkDir _ATKLinkFlags _ATKCflags)
162 FIND_PATH(GTK2_ATK_INCLUDE_PATH atk/atk.h
164 /opt/gnome/include/atk-1.0
169 #MESSAGE(STATUS "DEBUG: GTK2_ATK_INCLUDE_PATH = ${GTK2_ATK_INCLUDE_PATH}")
171 FIND_LIBRARY(GTK2_GTKGL_LIBRARY
185 FIND_LIBRARY(GTK2_GTK_LIBRARY
199 FIND_LIBRARY(GTK2_GDK_LIBRARY
213 FIND_LIBRARY(GTK2_GMODULE_LIBRARY
227 FIND_LIBRARY(GTK2_GLIB_LIBRARY
241 FIND_LIBRARY(GTK2_Xi_LIBRARY
254 FIND_LIBRARY(GTK2_GTHREAD_LIBRARY
268 FIND_LIBRARY(GTK2_GOBJECT_LIBRARY
281 IF(GTK2_GTK_INCLUDE_PATH)
282 IF(GTK2_GLIBCONFIG_INCLUDE_PATH)
283 IF(GTK2_GLIB_INCLUDE_PATH)
285 IF(GTK2_GLIB_LIBRARY)
286 IF(GTK2_PANGO_INCLUDE_PATH)
287 IF(GTK2_ATK_INCLUDE_PATH)
288 IF(GTK2_CAIRO_INCLUDE_PATH)
289 # Assume that if gtk and glib were found, the other
290 # supporting libraries have also been found.
294 SET(GTK2_INCLUDE_DIRS
295 ${GTK2_GTK_INCLUDE_PATH}
296 ${GTK2_GLIBCONFIG_INCLUDE_PATH}
297 ${GTK2_GLIB_INCLUDE_PATH}
298 ${GTK2_PANGO_INCLUDE_PATH}
299 ${GTK2_GDKCONFIG_INCLUDE_PATH}
300 ${GTK2_ATK_INCLUDE_PATH}
301 ${GTK2_CAIRO_INCLUDE_PATH}
309 #${GTK2_GOBJECT_LIBRARY})
311 IF(GTK2_GMODULE_LIBRARY)
314 ${GTK2_GMODULE_LIBRARY}
316 ENDIF(GTK2_GMODULE_LIBRARY)
318 IF(GTK2_GTHREAD_LIBRARY)
321 ${GTK2_GTHREAD_LIBRARY}
323 SET(GTK2_LIBRARIES ${GTK2_LIBRARIES})
324 ENDIF(GTK2_GTHREAD_LIBRARY)
325 ELSE(GTK2_CAIRO_INCLUDE_PATH)
326 MESSAGE(STATUS "Can not find cairo")
327 ENDIF(GTK2_CAIRO_INCLUDE_PATH)
328 ELSE(GTK2_ATK_INCLUDE_PATH)
329 MESSAGE(STATUS "Can not find atk")
330 ENDIF(GTK2_ATK_INCLUDE_PATH)
331 ELSE(GTK2_PANGO_INCLUDE_PATH)
332 MESSAGE(STATUS "Can not find pango includes")
333 ENDIF(GTK2_PANGO_INCLUDE_PATH)
334 ELSE(GTK2_GLIB_LIBRARY)
335 MESSAGE(STATUS "Can not find glib lib")
336 ENDIF(GTK2_GLIB_LIBRARY)
337 ELSE(GTK2_GTK_LIBRARY)
338 MESSAGE(STATUS "Can not find gtk lib")
339 ENDIF(GTK2_GTK_LIBRARY)
340 ELSE(GTK2_GLIB_INCLUDE_PATH)
341 MESSAGE(STATUS "Can not find glib includes")
342 ENDIF(GTK2_GLIB_INCLUDE_PATH)
343 ELSE(GTK2_GLIBCONFIG_INCLUDE_PATH)
344 MESSAGE(STATUS "Can not find glibconfig")
345 ENDIF(GTK2_GLIBCONFIG_INCLUDE_PATH)
346 ELSE (GTK2_GTK_INCLUDE_PATH)
347 MESSAGE(STATUS "Can not find gtk includes")
348 ENDIF (GTK2_GTK_INCLUDE_PATH)
351 IF (NOT GTK2_FIND_QUIETLY)
352 MESSAGE(STATUS "Found GTK2: ${GTK2_LIBRARIES}")
353 ENDIF (NOT GTK2_FIND_QUIETLY)
355 IF (GTK2_FIND_REQUIRED)
356 MESSAGE(SEND_ERROR "Could NOT find GTK2")
357 ENDIF (GTK2_FIND_REQUIRED)
362 GTK2_GLIB_INCLUDE_PATH
364 GTK2_GLIBCONFIG_INCLUDE_PATH
368 GTK2_GTK_INCLUDE_PATH
370 GTK2_GTKGL_INCLUDE_PATH
372 GTK2_ATK_INCLUDE_PATH
373 GTK2_GDKCONFIG_INCLUDE_PATH
374 #GTK2_GOBJECT_LIBRARY
375 GTK2_PANGO_INCLUDE_PATH
378 ENDIF (GTK2_LIBRARIES AND GTK2_INCLUDE_DIRS)
380 # vim:et ts=2 sw=2 comments=\:\#