Introduce "generator expressions" to add_test()
[cmake.git] / Modules / FindGTK.cmake
blob7d802415ba02724ec24e151782d1aa3da263647d
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
7 # don't even bother under WIN32
8 IF(UNIX)
10   FIND_PATH( GTK_gtk_INCLUDE_PATH NAMES gtk/gtk.h
11     PATH_SUFFIXES gtk-1.2 gtk12
12     PATHS
13     /usr/openwin/share/include
14     /usr/openwin/include
15     /opt/gnome/include
16   )
18   # Some Linux distributions (e.g. Red Hat) have glibconfig.h
19   # and glib.h in different directories, so we need to look
20   # for both.
21   #  - Atanas Georgiev <atanas@cs.columbia.edu>
23   FIND_PATH( GTK_glibconfig_INCLUDE_PATH NAMES glibconfig.h
24     PATHS
25     /usr/openwin/share/include
26     /usr/local/include/glib12
27     /usr/lib/glib/include
28     /usr/local/lib/glib/include
29     /opt/gnome/include
30     /opt/gnome/lib/glib/include
31   )
33   FIND_PATH( GTK_glib_INCLUDE_PATH NAMES glib.h
34     PATH_SUFFIXES gtk-1.2 glib-1.2 glib12
35     PATHS
36     /usr/openwin/share/include
37     /usr/lib/glib/include
38     /opt/gnome/include
39   )
41   FIND_PATH( GTK_gtkgl_INCLUDE_PATH NAMES gtkgl/gtkglarea.h
42     PATHS /usr/openwin/share/include
43           /opt/gnome/include
44   )
46   FIND_LIBRARY( GTK_gtkgl_LIBRARY gtkgl
47     /usr/openwin/lib
48     /opt/gnome/lib
49   )
51   #
52   # The 12 suffix is thanks to the FreeBSD ports collection
53   #
55   FIND_LIBRARY( GTK_gtk_LIBRARY
56     NAMES  gtk gtk12
57     PATHS /usr/openwin/lib
58           /opt/gnome/lib
59   )
61   FIND_LIBRARY( GTK_gdk_LIBRARY
62     NAMES  gdk gdk12
63     PATHS  /usr/openwin/lib
64            /opt/gnome/lib
65   )
67   FIND_LIBRARY( GTK_gmodule_LIBRARY
68     NAMES  gmodule gmodule12
69     PATHS  /usr/openwin/lib
70            /opt/gnome/lib
71   )
73   FIND_LIBRARY( GTK_glib_LIBRARY
74     NAMES  glib glib12
75     PATHS  /usr/openwin/lib
76            /opt/gnome/lib
77   )
79   FIND_LIBRARY( GTK_Xi_LIBRARY 
80     NAMES Xi 
81     PATHS /usr/openwin/lib 
82           /opt/gnome/lib 
83     ) 
85   FIND_LIBRARY( GTK_gthread_LIBRARY
86     NAMES  gthread gthread12
87     PATHS  /usr/openwin/lib
88            /opt/gnome/lib
89   )
91   IF(GTK_gtk_INCLUDE_PATH
92      AND GTK_glibconfig_INCLUDE_PATH
93      AND GTK_glib_INCLUDE_PATH
94      AND GTK_gtk_LIBRARY
95      AND GTK_glib_LIBRARY)
97     # Assume that if gtk and glib were found, the other
98     # supporting libraries have also been found.
100     SET( GTK_FOUND "YES" )
101     SET( GTK_INCLUDE_DIR  ${GTK_gtk_INCLUDE_PATH}
102                            ${GTK_glibconfig_INCLUDE_PATH}
103                            ${GTK_glib_INCLUDE_PATH} )
104     SET( GTK_LIBRARIES  ${GTK_gtk_LIBRARY}
105                         ${GTK_gdk_LIBRARY}
106                         ${GTK_glib_LIBRARY} )
108     IF(GTK_gmodule_LIBRARY)
109       SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gmodule_LIBRARY})
110     ENDIF(GTK_gmodule_LIBRARY)
111     IF(GTK_gthread_LIBRARY)
112       SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_gthread_LIBRARY})
113     ENDIF(GTK_gthread_LIBRARY)
114     IF(GTK_Xi_LIBRARY)
115       SET(GTK_LIBRARIES ${GTK_LIBRARIES} ${GTK_Xi_LIBRARY})
116     ENDIF(GTK_Xi_LIBRARY)
118     IF(GTK_gtkgl_INCLUDE_PATH AND GTK_gtkgl_LIBRARY)
119       SET( GTK_GL_FOUND "YES" )
120       SET( GTK_INCLUDE_DIR  ${GTK_INCLUDE_DIR}
121                             ${GTK_gtkgl_INCLUDE_PATH} )
122       SET( GTK_LIBRARIES  ${GTK_gtkgl_LIBRARY} ${GTK_LIBRARIES} )
123       MARK_AS_ADVANCED(
124         GTK_gtkgl_LIBRARY
125         GTK_gtkgl_INCLUDE_PATH
126         )
127     ENDIF(GTK_gtkgl_INCLUDE_PATH AND GTK_gtkgl_LIBRARY)
129   ENDIF(GTK_gtk_INCLUDE_PATH
130      AND GTK_glibconfig_INCLUDE_PATH
131      AND GTK_glib_INCLUDE_PATH
132      AND GTK_gtk_LIBRARY
133      AND GTK_glib_LIBRARY)
135   MARK_AS_ADVANCED(
136     GTK_gdk_LIBRARY
137     GTK_glib_INCLUDE_PATH
138     GTK_glib_LIBRARY
139     GTK_glibconfig_INCLUDE_PATH
140     GTK_gmodule_LIBRARY
141     GTK_gthread_LIBRARY
142     GTK_Xi_LIBRARY
143     GTK_gtk_INCLUDE_PATH
144     GTK_gtk_LIBRARY
145     GTK_gtkgl_INCLUDE_PATH
146     GTK_gtkgl_LIBRARY
147   )
149 ENDIF(UNIX)