File: FindMyGTK2.cmake

package info (click to toggle)
visp 3.6.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 119,296 kB
  • sloc: cpp: 500,914; ansic: 52,904; xml: 22,642; python: 7,365; java: 4,247; sh: 482; makefile: 237; objc: 145
file content (305 lines) | stat: -rw-r--r-- 8,952 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
#############################################################################
#
# ViSP, open source Visual Servoing Platform software.
# Copyright (C) 2005 - 2023 by Inria. All rights reserved.
#
# This software is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# See the file LICENSE.txt at the root directory of this source
# distribution for additional information about the GNU GPL.
#
# For using ViSP with software that can not be combined with the GNU
# GPL, please contact Inria about acquiring a ViSP Professional
# Edition License.
#
# See https://visp.inria.fr for more information.
#
# This software was developed at:
# Inria Rennes - Bretagne Atlantique
# Campus Universitaire de Beaulieu
# 35042 Rennes Cedex
# France
#
# If you have questions regarding the use of this file, please contact
# Inria at visp@inria.fr
#
# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#
# Description:
# Try to find GTK (and glib).
# Once run this will define:
#
# GTK2_INCLUDE_DIRS  - Directories to include to use GTK
# GTK2_LIBRARIES     - Files to link against to use GTK
# GTK2_FOUND         - If false, don't try to use GTK
# GTK2_GL_FOUND      - If false, don't try to use GTK's GL features
# GTK2_VERSION
#
#############################################################################

if(UNIX OR WIN32)

  find_path( GTK2_gtk_INCLUDE_PATH gtk/gtk.h
    $ENV{GTK2_DIR}/include/gtk-2.0
    $ENV{GTK2_HOME}/include/gtk-2.0
    /usr/include/gtk-2.0
    /usr/local/include/gtk-2.0
    /opt/gnome/include/gtk-2.0
    "C:/GTK/include/gtk-2.0"
    /sw/include/gtk-2.0
  )

  # Some Linux distributions (e.g. Red Hat) have glibconfig.h
  # and glib.h in different directories, so we need to look
  # for both.
  #  - Atanas Georgiev <atanas@cs.columbia.edu>

  find_path( GTK2_glibconfig_INCLUDE_PATH glibconfig.h
    $ENV{GTK2_DIR}/lib/glib-2.0/include
    $ENV{GTK2_HOME}/lib/glib-2.0/include
    /usr/lib/glib-2.0/include
    /usr/lib64/glib-2.0/include
    /usr/lib/i386-linux-gnu/glib-2.0/include
    /usr/lib/x86_64-linux-gnu/glib-2.0/include
    /opt/gnome/lib/glib-2.0/include
    C:/GTK/lib/glib-2.0/include
    /sw/lib/glib-2.0/include
  )

  find_path( GTK2_glib_INCLUDE_PATH glib.h
    $ENV{GTK2_DIR}/include/glib-2.0
    $ENV{GTK2_HOME}/include/glib-2.0
    /usr/include/glib-2.0
    /opt/gnome/include/glib-2.0
    C:/GTK/include/glib-2.0
    /sw/include/glib-2.0
  )

  find_path( GTK2_pango_INCLUDE_PATH pango/pango.h
    $ENV{GTK2_DIR}/include/pango-1.0
    $ENV{GTK2_HOME}/include/pango-1.0
    /usr/include/pango-1.0
    /opt/gnome/include/pango-1.0
    C:/GTK/include/pango-1.0
    /sw/include/pango-1.0
  )

  find_path( GTK2_harfbuzz_INCLUDE_PATH hb.h
    $ENV{GTK2_DIR}/include/harfbuzz
    $ENV{GTK2_HOME}/include/harfbuzz
    /usr/include/harfbuzz
    /opt/gnome/include/harfbuzz
    C:/GTK/include/harfbuzz
    /sw/include/harfbuzz
  )

  find_path( GTK2_cairo_INCLUDE_PATH cairo.h
    $ENV{GTK2_DIR}/include/cairo
    $ENV{GTK2_HOME}/include/cairo
    /usr/include/cairo
    /opt/gnome/include/cairo
    C:/GTK/include/cairo
    /sw/include/cairo
  )

  find_path( GTK2_gdkconfig_INCLUDE_PATH gdkconfig.h
    $ENV{GTK2_DIR}/lib/gtk-2.0/include
    $ENV{GTK2_HOME}/lib/gtk-2.0/include
    /usr/lib/gtk-2.0/include
    /usr/lib64/gtk-2.0/include
    /opt/gnome/lib/gtk-2.0/include
    C:/GTK/lib/gtk-2.0/include
    /sw/lib/gtk-2.0/include
    /usr/lib/i386-linux-gnu/gtk-2.0/include
    /usr/lib/x86_64-linux-gnu/gtk-2.0/include
  )

  find_path( GTK2_gdkpixbuf_INCLUDE_PATH gdk-pixbuf/gdk-pixbuf.h
    $ENV{GTK2_DIR}/gdk-pixbuf-2.0
    $ENV{GTK2_HOME}/gdk-pixbuf-2.0
    /usr/include/gdk-pixbuf-2.0
    /usr/include/gtk-2.0
    C:/GTK/include/gtk-2.0
    /sw/include/gtk-2.0
  )

  find_path( GTK2_atk_INCLUDE_PATH atk/atk.h
    $ENV{GTK2_DIR}/include/atk-1.0
    $ENV{GTK2_HOME}/include/atk-1.0
    /usr/include/atk-1.0
    /opt/gnome/include/atk-1.0
    C:/GTK/include/atk-1.0
    /sw/include/atk-1.0
  )

  find_library( GTK2_gtk_LIBRARY
    NAMES  gtk-x11-2.0 gtk-win32-2.0
    PATHS $ENV{GTK2_DIR}/lib
    PATHS $ENV{GTK2_HOME}/lib
          /usr/lib
          /usr/local/lib
          /usr/openwin/lib
          /usr/X11R6/lib
          /opt/gnome/lib
          C:/GTK/lib
	  /sw/lib
  )

  find_library( GTK2_gdk_LIBRARY
    NAMES  gdk-x11-2.0 gdk-win32-2.0
    PATHS  $ENV{GTK2_DIR}/lib
    PATHS  $ENV{GTK2_HOME}/lib
           /usr/lib
           /usr/local/lib
           /usr/openwin/lib
           /usr/X11R6/lib
           /opt/gnome/lib
           C:/GTK/lib
	   /sw/lib
  )

  find_library( GTK2_gmodule_LIBRARY
    NAMES  gmodule-2.0
    PATHS  $ENV{GTK2_DIR}/lib
    PATHS  $ENV{GTK2_HOME}/lib
           /usr/lib
           /usr/local/lib
           /usr/openwin/lib
           /usr/X11R6/lib
           /opt/gnome/lib
           C:/GTK/lib
	   /sw/lib
  )

  find_library( GTK2_glib_LIBRARY
    NAMES  glib-2.0
    PATHS  $ENV{GTK2_DIR}/lib
    PATHS  $ENV{GTK2_HOME}/lib
           /usr/lib
           /usr/local/lib
           /usr/openwin/lib
           /usr/X11R6/lib
           /opt/gnome/lib
           C:/GTK/lib
	   /sw/lib
  )

  find_library( GTK2_gthread_LIBRARY
    NAMES  gthread-2.0
    PATHS  $ENV{GTK2_DIR}/lib
    PATHS  $ENV{GTK2_HOME}/lib
           /usr/lib
           /usr/local/lib
           /usr/openwin/lib
           /usr/X11R6/lib
           /opt/gnome/lib
           C:/GTK/lib
	   /sw/lib
  )

  find_library( GTK2_gobject_LIBRARY
    NAMES  gobject-2.0
    PATHS  $ENV{GTK2_DIR}/lib
    PATHS  $ENV{GTK2_HOME}/lib
           /usr/lib
           /opt/gnome/lib
           C:/GTK/lib
	   /sw/lib
  )

  if(GTK2_gtk_INCLUDE_PATH)
  if(GTK2_glib_INCLUDE_PATH)
  if(GTK2_glibconfig_INCLUDE_PATH)
  if(GTK2_gtk_LIBRARY)
  if(GTK2_glib_LIBRARY)
  if(GTK2_pango_INCLUDE_PATH)
  if(GTK2_gdkconfig_INCLUDE_PATH)
    if(GTK2_atk_INCLUDE_PATH)
      # Assume that if gtk and glib were found, the other
      # supporting libraries have also been found.

      set( GTK2_FOUND "YES" )
      set( GTK2_INCLUDE_DIRS ${GTK2_gtk_INCLUDE_PATH}
                             ${GTK2_glib_INCLUDE_PATH}
                             ${GTK2_glibconfig_INCLUDE_PATH}
                             ${GTK2_pango_INCLUDE_PATH}
                             ${GTK2_atk_INCLUDE_PATH}
                             ${GTK2_gdkconfig_INCLUDE_PATH})
      if(GTK2_cairo_INCLUDE_PATH)
        list(APPEND GTK2_INCLUDE_DIRS  ${GTK2_cairo_INCLUDE_PATH} )
      endif()
      if(GTK2_gdkpixbuf_INCLUDE_PATH)
        LIST(APPEND GTK2_INCLUDE_DIRS  ${GTK2_gdkpixbuf_INCLUDE_PATH} )
      endif()
      if(GTK2_gdkconfig_INCLUDE_PATH)
        LIST(APPEND GTK2_INCLUDE_DIRS  ${GTK2_gdkconfig_INCLUDE_PATH} )
      endif()
      if(GTK2_harfbuzz_INCLUDE_PATH)
        LIST(APPEND GTK2_INCLUDE_DIRS  ${GTK2_harfbuzz_INCLUDE_PATH} )
      endif()

      set( GTK2_LIBRARIES ${GTK2_gtk_LIBRARY}
                          ${GTK2_gdk_LIBRARY}
                          ${GTK2_glib_LIBRARY}
                          ${GTK2_gobject_LIBRARY})

      get_filename_component(GTK2_LIB_DIR ${GTK2_gtk_LIBRARY} PATH)
      vp_get_version_from_pkg("gtk+-2.0" "${GTK2_LIB_DIR}/pkgconfig" GTK2_VERSION)

      if(GTK2_gmodule_LIBRARY)
        list(APPEND GTK2_LIBRARIES ${GTK2_gmodule_LIBRARY})
      endif()
      if(GTK2_gthread_LIBRARY)
        list(APPEND GTK2_LIBRARIES ${GTK2_gthread_LIBRARY})
      endif()

    else(GTK2_atk_INCLUDE_PATH)
      message("Can not find atk")
    endif()
  else(GTK2_gdkconfig_INCLUDE_PATH)
    #message("Can not find gdkconfig include")
  endif(GTK2_gdkconfig_INCLUDE_PATH)
  else(GTK2_pango_INCLUDE_PATH)
    #message("Can not find pango includes")
  endif(GTK2_pango_INCLUDE_PATH)
  else(GTK2_glib_LIBRARY)
    #message("Can not find glib lib")
  endif(GTK2_glib_LIBRARY)
  else(GTK2_gtk_LIBRARY)
    #message("Can not find gtk lib")
  endif(GTK2_gtk_LIBRARY)
  else(GTK2_glibconfig_INCLUDE_PATH)
    #message("Can not find glibconfig includes")
  endif(GTK2_glibconfig_INCLUDE_PATH)
  else(GTK2_glib_INCLUDE_PATH)
    #message("Can not find glib includes")
  endif(GTK2_glib_INCLUDE_PATH)
  else(GTK2_gtk_INCLUDE_PATH)
    #message("Can not find gtk includes")
  endif(GTK2_gtk_INCLUDE_PATH)

  mark_as_advanced(
    GTK2_gdk_LIBRARY
    GTK2_glib_INCLUDE_PATH
    GTK2_glib_LIBRARY
    GTK2_glibconfig_INCLUDE_PATH
    GTK2_gmodule_LIBRARY
    GTK2_gthread_LIBRARY
    GTK2_gtk_INCLUDE_PATH
    GTK2_gtk_LIBRARY
    GTK2_atk_INCLUDE_PATH
    GTK2_gdkconfig_INCLUDE_PATH
    GTK2_gobject_LIBRARY
    GTK2_pango_INCLUDE_PATH
    GTK2_cairo_INCLUDE_PATH
    GTK2_harfbuzz_INCLUDE_PATH
    GTK2_gdkpixbuf_INCLUDE_PATH
  )

else(UNIX OR WIN32)
  message("FindGTK2 is working on UNIX/LINUX and Windows, only!")
endif()