ENH: move EstimateFormatLength to kwsys
[cmake.git] / Modules / FindGTK.cmake
blob81158a06c2be2d0cd72b270e414072ef6ecbc009
2 # try to find GTK (and glib) and GTKGLArea
5 # GTK_INCLUDE_DIR   - Directories to include to use GTK
6 # GTK_LIBRARIES     - Files to link against to use GTK
7 # GTK_FOUND         - If false, don't try to use GTK
8 # GTK_GL_FOUND      - If false, don't try to use GTK's GL features
10 # don't even bother under WIN32
11 IF(UNIX)
13   FIND_PATH( GTK_gtk_INCLUDE_PATH gtk/gtk.h
14     /usr/include
15     /usr/local/include
16     /usr/openwin/share/include
17     /usr/openwin/include
18     /usr/X11R6/include
19     /usr/include/X11
20     /usr/X11R6/include/gtk12
21     /usr/include/gtk-1.2
22     /usr/local/include/gtk-1.2
23     /opt/gnome/include
24   )
26   # Some Linux distributions (e.g. Red Hat) have glibconfig.h
27   # and glib.h in different directories, so we need to look
28   # for both.
29   #  - Atanas Georgiev <atanas@cs.columbia.edu>
31   FIND_PATH( GTK_glibconfig_INCLUDE_PATH glibconfig.h
32     /usr/include
33     /usr/local/include
34     /usr/openwin/share/include
35     /usr/local/include/glib12
36     /usr/lib/glib/include
37     /usr/local/lib/glib/include
38     /opt/gnome/include
39     /opt/gnome/lib/glib/include
40   )
42   FIND_PATH( GTK_glib_INCLUDE_PATH glib.h
43     /usr/include
44     /usr/local/include
45     /usr/openwin/share/include
46     /usr/include/gtk-1.2
47     /usr/local/include/glib12
48     /usr/lib/glib/include
49     /usr/include/glib-1.2
50     /usr/local/include/glib-1.2
51     /opt/gnome/include
52     /opt/gnome/include/glib-1.2
53   )
55   FIND_PATH( GTK_gtkgl_INCLUDE_PATH gtkgl/gtkglarea.h
56     /usr/include
57     /usr/local/include
58     /usr/openwin/share/include
59     /opt/gnome/include
60   )
62   FIND_LIBRARY( GTK_gtkgl_LIBRARY gtkgl
63     /usr/lib
64     /usr/local/lib
65     /usr/openwin/lib
66     /usr/X11R6/lib
67     /opt/gnome/lib
68   )
70   #
71   # The 12 suffix is thanks to the FreeBSD ports collection
72   #
74   FIND_LIBRARY( GTK_gtk_LIBRARY
75     NAMES  gtk gtk12
76     PATHS /usr/lib
77           /usr/local/lib
78           /usr/openwin/lib
79           /usr/X11R6/lib
80           /opt/gnome/lib
81   )
83   FIND_LIBRARY( GTK_gdk_LIBRARY
84     NAMES  gdk gdk12
85     PATHS  /usr/lib
86            /usr/local/lib
87            /usr/openwin/lib
88            /usr/X11R6/lib
89            /opt/gnome/lib
90   )
92   FIND_LIBRARY( GTK_gmodule_LIBRARY
93     NAMES  gmodule gmodule12
94     PATHS  /usr/lib
95            /usr/local/lib
96            /usr/openwin/lib
97            /usr/X11R6/lib
98            /opt/gnome/lib
99   )
101   FIND_LIBRARY( GTK_glib_LIBRARY
102     NAMES  glib glib12
103     PATHS  /usr/lib
104            /usr/local/lib
105            /usr/openwin/lib
106            /usr/X11R6/lib
107            /opt/gnome/lib
108   )
110   FIND_LIBRARY( GTK_Xi_LIBRARY 
111     NAMES Xi 
112     PATHS /usr/lib 
113     /usr/local/lib 
114     /usr/openwin/lib 
115     /usr/X11R6/lib 
116     /opt/gnome/lib 
117     ) 
119   FIND_LIBRARY( GTK_gthread_LIBRARY
120     NAMES  gthread gthread12
121     PATHS  /usr/lib
122            /usr/local/lib
123            /usr/openwin/lib
124            /usr/X11R6/lib
125            /opt/gnome/lib
126   )
128   IF(GTK_gtk_INCLUDE_PATH)
129   IF(GTK_glibconfig_INCLUDE_PATH)
130   IF(GTK_glib_INCLUDE_PATH)
131   IF(GTK_gtk_LIBRARY)
132   IF(GTK_glib_LIBRARY)
134     # Assume that if gtk and glib were found, the other
135     # supporting libraries have also been found.
137     SET( GTK_FOUND "YES" )
138     SET( GTK_INCLUDE_DIR  ${GTK_gtk_INCLUDE_PATH}
139                            ${GTK_glibconfig_INCLUDE_PATH}
140                            ${GTK_glib_INCLUDE_PATH} )
141     SET( GTK_LIBRARIES  ${GTK_gtk_LIBRARY}
142                         ${GTK_gdk_LIBRARY}
143                         ${GTK_glib_LIBRARY} )
145     IF(GTK_gmodule_LIBRARY)
146       SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gmodule_LIBRARY})
147     ENDIF(GTK_gmodule_LIBRARY)
148     IF(GTK_gthread_LIBRARY)
149       SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gthread_LIBRARY})
150     ENDIF(GTK_gthread_LIBRARY)
151     IF(GTK_Xi_LIBRARY)
152       SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_Xi_LIBRARY})
153     ENDIF(GTK_Xi_LIBRARY)
155   IF(GTK_gtkgl_INCLUDE_PATH)
156   IF(GTK_gtkgl_LIBRARY)
157     SET( GTK_GL_FOUND "YES" )
158     SET( GTK_INCLUDE_DIR  ${GTK_INCLUDE_DIR}
159                            ${GTK_gtkgl_INCLUDE_PATH} )
160     SET( GTK_LIBRARIES  ${GTK_gtkgl_LIBRARY} ${GTK_LIBRARIES} )
161     MARK_AS_ADVANCED(
162       GTK_gtkgl_LIBRARY
163       GTK_gtkgl_INCLUDE_PATH
164       )
165   ENDIF(GTK_gtkgl_LIBRARY)
166   ENDIF(GTK_gtkgl_INCLUDE_PATH)
168   ENDIF(GTK_glib_LIBRARY)
169   ENDIF(GTK_gtk_LIBRARY)
170   ENDIF(GTK_glib_INCLUDE_PATH) 
171   ENDIF(GTK_glibconfig_INCLUDE_PATH)
172   ENDIF(GTK_gtk_INCLUDE_PATH)
174   MARK_AS_ADVANCED(
175     GTK_gdk_LIBRARY
176     GTK_glib_INCLUDE_PATH
177     GTK_glib_LIBRARY
178     GTK_glibconfig_INCLUDE_PATH
179     GTK_gmodule_LIBRARY
180     GTK_gthread_LIBRARY
181     GTK_Xi_LIBRARY
182     GTK_gtk_INCLUDE_PATH
183     GTK_gtk_LIBRARY
184     GTK_gtkgl_INCLUDE_PATH
185     GTK_gtkgl_LIBRARY
186   )
188 ENDIF(UNIX)