ENH: make this work for older versions of OSX
[cmake.git] / Modules / FindGTK2.cmake
blob6921269425951b1aa382ad45ec8b67aaeefebae9
1 # - FindGTK2.cmake
2 # This module can find the GTK2 widget libraries and several of its other
3 # optional components like gtkmm, glade, and glademm.
5 # NOTE: If you intend to use version checking, CMake 2.6.2 or later is
6 #       required.
8 # Specify one or more of the following components
9 # as you call this find module. See example below.
11 #   gtk
12 #   gtkmm
13 #   glade
14 #   glademm
16 # The following variables will be defined for your use
18 #   GTK2_FOUND - Were all of your specified components found?
19 #   GTK2_INCLUDE_DIRS - All include directories
20 #   GTK2_LIBRARIES - All libraries
22 #   GTK2_VERSION - The version of GTK2 found (x.y.z)
23 #   GTK2_MAJOR_VERSION - The major version of GTK2
24 #   GTK2_MINOR_VERSION - The minor version of GTK2
25 #   GTK2_PATCH_VERSION - The patch version of GTK2
27 # Optional variables you can define prior to calling this module:
29 #   GTK2_DEBUG - Enables verbose debugging of the module
30 #   GTK2_SKIP_MARK_AS_ADVANCED - Disable marking cache variables as advanced
32 #=================
33 # Example Usage:
35 #   Call find_package() once, here are some examples to pick from:
37 #   Require GTK 2.6 or later
38 #       find_package(GTK2 2.6 REQUIRED gtk)
40 #   Require GTK 2.10 or later and Glade
41 #       find_package(GTK2 2.10 REQUIRED gtk glade)
43 #   Search for GTK/GTKMM 2.8 or later
44 #       find_package(GTK2 2.8 COMPONENTS gtk gtkmm)
46 #   if(GTK2_FOUND)
47 #      include_directories(${GTK2_INCLUDE_DIRS})
48 #      add_executable(mygui mygui.cc)
49 #      target_link_libraries(mygui ${GTK2_LIBRARIES})
50 #   endif()
52 #=================
53
54 # Copyright (c) 2008-2009
55 #     Philip Lowman <philip@yhbt.com>
57 # Version 0.7 (3/22/09)
58 #   * Checked into CMake CVS
59 #   * Added versioning support
60 #   * Module now defaults to searching for GTK if COMPONENTS not specified.
61 #   * Added HKCU prior to HKLM registry key and GTKMM specific environment
62 #      variable as per mailing list discussion.
63 #   * Added lib64 to include search path and a few other search paths where GTK
64 #      may be installed on Unix systems.
65 #   * Switched to lowercase CMake commands
66 #   * Prefaced internal variables with _GTK2 to prevent collision
67 #   * Changed internal macros to functions
68 #   * Enhanced documentation
69 # Version 0.6 (1/8/08)
70 #   Added GTK2_SKIP_MARK_AS_ADVANCED option
71 # Version 0.5 (12/19/08)
72 #   Second release to cmake mailing list
74 # Redistribution and use is allowed according to the terms of the BSD license.
75 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
78 #=============================================================
79 # _GTK2_GET_VERSION
80 # Internal function to parse the version number in gtkversion.h
81 #   _OUT_major = Major version number
82 #   _OUT_minor = Minor version number
83 #   _OUT_micro = Micro version number
84 #   _gtkversion_hdr = Header file to parse
85 #=============================================================
86 function(_GTK2_GET_VERSION _OUT_major _OUT_minor _OUT_micro _gtkversion_hdr)
87     file(READ ${_gtkversion_hdr} _contents)
88     if(_contents)
89         string(REGEX REPLACE ".*#define GTK_MAJOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_major} "${_contents}")
90         string(REGEX REPLACE ".*#define GTK_MINOR_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_minor} "${_contents}")
91         string(REGEX REPLACE ".*#define GTK_MICRO_VERSION[ \t]+\\(([0-9]+)\\).*" "\\1" ${_OUT_micro} "${_contents}")
92         
93         if(NOT ${_OUT_major} MATCHES "[0-9]+")
94             message(FATAL_ERROR "Version parsing failed for GTK2_MAJOR_VERSION!")
95         endif()
96         if(NOT ${_OUT_minor} MATCHES "[0-9]+")
97             message(FATAL_ERROR "Version parsing failed for GTK2_MINOR_VERSION!")
98         endif()
99         if(NOT ${_OUT_micro} MATCHES "[0-9]+")
100             message(FATAL_ERROR "Version parsing failed for GTK2_MICRO_VERSION!")
101         endif()
103         set(${_OUT_major} ${${_OUT_major}} PARENT_SCOPE)
104         set(${_OUT_minor} ${${_OUT_minor}} PARENT_SCOPE)
105         set(${_OUT_micro} ${${_OUT_micro}} PARENT_SCOPE)
106     else()
107         message(FATAL_ERROR "Include file ${_gtkversion_hdr} does not exist")
108     endif()
109 endfunction()
111 #=============================================================
112 # _GTK2_FIND_INCLUDE_DIR
113 # Internal function to find the GTK include directories
114 #   _var = variable to set
115 #   _hdr = header file to look for
116 #=============================================================
117 function(_GTK2_FIND_INCLUDE_DIR _var _hdr)
119     if(GTK2_DEBUG)
120         message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
121                        "_GTK2_FIND_INCLUDE_DIR( ${_var} ${_hdr} )")
122     endif()
124     set(_relatives
125         # FIXME
126         glibmm-2.4
127         glib-2.0
128         atk-1.0
129         atkmm-1.6
130         cairo
131         cairomm-1.0
132         gdkmm-2.4
133         giomm-2.4
134         gtk-2.0
135         gtkmm-2.4
136         libglade-2.0
137         libglademm-2.4
138         pango-1.0
139         pangomm-1.4
140         sigc++-2.0
141     )
143     set(_suffixes)
144     foreach(_d ${_relatives})
145         list(APPEND _suffixes ${_d})
146         list(APPEND _suffixes ${_d}/include) # for /usr/lib/gtk-2.0/include
147     endforeach()
149     if(GTK2_DEBUG)
150         message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}]     "
151                        "include suffixes = ${_suffixes}")
152     endif()
154     find_path(${_var} ${_hdr}
155         PATHS
156             /usr/local/lib64
157             /usr/local/lib
158             /usr/lib64
159             /usr/lib
160             /opt/gnome/include
161             /opt/gnome/lib
162             /opt/openwin/include
163             /usr/openwin/lib
164             $ENV{GTKMM_BASEPATH}/include
165             $ENV{GTKMM_BASEPATH}/lib
166             [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/include
167             [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib
168             [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/include
169             [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib
170         PATH_SUFFIXES
171             ${_suffixes}
172     )
174     if(${_var})
175         set(GTK2_INCLUDE_DIRS ${GTK2_INCLUDE_DIRS} ${${_var}} PARENT_SCOPE)
176         if(NOT GTK2_SKIP_MARK_AS_ADVANCED)
177             mark_as_advanced(${_var})
178         endif()
179     endif()
181 endfunction(_GTK2_FIND_INCLUDE_DIR)
183 #=============================================================
184 # _GTK2_FIND_LIBRARY
185 # Internal function to find libraries packaged with GTK2
186 #   _var = library variable to create
187 #=============================================================
188 function(_GTK2_FIND_LIBRARY _var _lib _expand_vc _append_version)
190     if(GTK2_DEBUG)
191         message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
192                        "_GTK2_FIND_LIBRARY( ${_var} ${_lib} ${_expand_vc} ${_append_version} )")
193     endif()
195     # Not GTK versions per se but the versions encoded into Windows
196     # import libraries (GtkMM 2.14.1 has a gtkmm-vc80-2_4.lib for example)
197     # Also the MSVC libraries use _ for . (this is handled below)
198     set(_versions 2.20 2.18 2.16 2.14 2.12
199                   2.10  2.8  2.6  2.4  2.2 2.0
200                   1.20 1.18 1.16 1.14 1.12
201                   1.10  1.8  1.6  1.4  1.2 1.0)
203     set(_library)
204     set(_library_d)
206     set(_library ${_lib})
208     if(_expand_vc)
209         # Add vc80/vc90 midfixes
210         if(MSVC80)
211             set(_library   ${_library}-vc80)
212             set(_library_d ${_library}-d)
213         elseif(MSVC90)
214             set(_library   ${_library}-vc90)
215             set(_library_d ${_library}-d)
216         endif()
217     endif()
219     if(GTK2_DEBUG)
220         message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}]     "
221                        "After midfix addition = ${_library} and ${_library_d}")
222     endif()
224     set(_lib_list)
225     set(_libd_list)
226     if(_append_version)
227         foreach(_ver ${_versions})
228             list(APPEND _lib_list  "${_library}-${_ver}")
229             list(APPEND _libd_list "${_library_d}-${_ver}")
230         endforeach()
231     else()
232         set(_lib_list ${_library})
233         set(_libd_list ${_library_d})
234     endif()
235     
236     if(GTK2_DEBUG)
237         message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}]     "
238                        "library list = ${_lib_list} and library debug list = ${_libd_list}")
239     endif()
241     # For some silly reason the MSVC libraries use _ instead of .
242     # in the version fields
243     if(_expand_vc AND MSVC)
244         set(_no_dots_lib_list)
245         set(_no_dots_libd_list)
246         foreach(_l ${_lib_list})
247             string(REPLACE "." "_" _no_dots_library ${_l})
248             list(APPEND _no_dots_lib_list ${_no_dots_library})
249         endforeach()
250         # And for debug
251         set(_no_dots_libsd_list)
252         foreach(_l ${_libd_list})
253             string(REPLACE "." "_" _no_dots_libraryd ${_l})
254             list(APPEND _no_dots_libd_list ${_no_dots_libraryd})
255         endforeach()
257         # Copy list back to original names
258         set(_lib_list ${_no_dots_lib_list})
259         set(_libd_list ${_no_dots_libd_list})
260     endif()
262     if(GTK2_DEBUG)
263         message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}]     "
264                        "While searching for ${_var}, our proposed library list is ${_lib_list}")
265     endif()
267     find_library(${_var} 
268         NAMES ${_lib_list}
269         PATHS
270             /opt/gnome/lib
271             /opt/gnome/lib64
272             /usr/openwin/lib
273             /usr/openwin/lib64
274             $ENV{GTKMM_BASEPATH}/lib
275             [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib
276             [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib
277         )
279     if(_expand_vc AND MSVC)
280         if(GTK2_DEBUG)
281             message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}]     "
282                            "While searching for ${_var}_DEBUG our proposed library list is ${_libd_list}")
283         endif()
285         find_library(${_var}_DEBUG
286             NAMES ${_libd_list}
287             PATHS
288             $ENV{GTKMM_BASEPATH}/lib
289             [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]/lib
290             [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]/lib
291         )
293         if(${_var} AND ${_var}_DEBUG)
294             if(NOT GTK2_SKIP_MARK_AS_ADVANCED)
295                 mark_as_advanced(${_var}_DEBUG)
296             endif()
297             set(GTK2_LIBRARIES ${GTK2_LIBRARIES} optimized ${${_var}} debug ${${_var}_DEBUG})
298             set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE)
299         endif()
300     else()
301         if(NOT GTK2_SKIP_MARK_AS_ADVANCED)
302             mark_as_advanced(${_var})
303         endif()
304         set(GTK2_LIBRARIES ${GTK2_LIBRARIES} ${${_var}})
305         set(GTK2_LIBRARIES ${GTK2_LIBRARIES} PARENT_SCOPE)
306         # Set debug to release
307         set(${_var}_DEBUG ${${_var}})
308         set(${_var}_DEBUG ${${_var}} PARENT_SCOPE)
309     endif()
310 endfunction(_GTK2_FIND_LIBRARY)
312 #=============================================================
315 # main()
318 set(GTK2_FOUND)
319 set(GTK2_INCLUDE_DIRS)
320 set(GTK2_LIBRARIES)
322 if(NOT GTK2_FIND_COMPONENTS)
323     # Assume they only want GTK
324     set(GTK2_FIND_COMPONENTS gtk)
325 endif()
328 # If specified, enforce version number
330 if(GTK2_FIND_VERSION)
331     cmake_minimum_required(VERSION 2.6.2)
332     set(GTK2_FAILED_VERSION_CHECK true)
333     if(GTK2_DEBUG)
334         message(STATUS "[FindGTK2.cmake:${CMAKE_CURRENT_LIST_LINE}] "
335                        "Searching for version ${GTK2_FIND_VERSION}")
336     endif()
337     _GTK2_FIND_INCLUDE_DIR(GTK2_GTK_INCLUDE_DIR gtk/gtk.h)
338     if(GTK2_GTK_INCLUDE_DIR)
339         _GTK2_GET_VERSION(GTK2_MAJOR_VERSION
340                           GTK2_MINOR_VERSION
341                           GTK2_PATCH_VERSION
342                           ${GTK2_GTK_INCLUDE_DIR}/gtk/gtkversion.h)
343         set(GTK2_VERSION
344             ${GTK2_MAJOR_VERSION}.${GTK2_MINOR_VERSION}.${GTK2_PATCH_VERSION})
345         if(GTK2_FIND_VERSION_EXACT)
346             if(GTK2_VERSION VERSION_EQUAL GTK2_FIND_VERSION)
347                 set(GTK2_FAILED_VERSION_CHECK false)
348             endif()
349         else()
350             if(GTK2_VERSION VERSION_EQUAL   GTK2_FIND_VERSION OR
351                GTK2_VERSION VERSION_GREATER GTK2_FIND_VERSION)
352                 set(GTK2_FAILED_VERSION_CHECK false)
353             endif()
354         endif()
355     else()
356         # If we can't find the GTK include dir, we can't do version checking
357         if(GTK2_FIND_REQUIRED AND NOT GTK2_FIND_QUIETLY)
358             message(FATAL_ERROR "Could not find GTK2 include directory")
359         endif()
360         return()
361     endif()
363     if(GTK2_FAILED_VERSION_CHECK)
364         if(GTK2_FIND_REQUIRED AND NOT GTK2_FIND_QUIETLY)
365             if(GTK2_FIND_VERSION_EXACT)
366                 message(FATAL_ERROR "GTK2 version check failed.  Version ${GTK2_VERSION} was found, version ${GTK2_FIND_VERSION} is needed exactly.")
367             else()
368                 message(FATAL_ERROR "GTK2 version check failed.  Version ${GTK2_VERSION} was found, at least version ${GTK2_FIND_VERSION} is required")
369             endif()
370         endif()    
371         
372         # If the version check fails, exit out of the module here
373         return()
374     endif()
375 endif()
378 # Find all components
381 foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
382     if(_GTK2_component STREQUAL "gtk")
383         
384         _GTK2_FIND_INCLUDE_DIR(GTK2_GLIB_INCLUDE_DIR glib.h)
385         _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBCONFIG_INCLUDE_DIR glibconfig.h)
386         _GTK2_FIND_LIBRARY    (GTK2_GLIB_LIBRARY glib false true)
388         _GTK2_FIND_INCLUDE_DIR(GTK2_GDK_INCLUDE_DIR gdk/gdk.h)
389         _GTK2_FIND_INCLUDE_DIR(GTK2_GDKCONFIG_INCLUDE_DIR gdkconfig.h)
390         _GTK2_FIND_LIBRARY    (GTK2_GDK_LIBRARY gdk-x11 false true)
391         _GTK2_FIND_LIBRARY    (GTK2_GDK_LIBRARY gdk-win32 false true)
393         _GTK2_FIND_INCLUDE_DIR(GTK2_GTK_INCLUDE_DIR gtk/gtk.h)
394         _GTK2_FIND_LIBRARY    (GTK2_GTK_LIBRARY gtk-x11 false true)
395         _GTK2_FIND_LIBRARY    (GTK2_GTK_LIBRARY gtk-win32 false true)
397         _GTK2_FIND_INCLUDE_DIR(GTK2_CAIRO_INCLUDE_DIR cairo.h)
398         _GTK2_FIND_LIBRARY    (GTK2_CAIRO_LIBRARY cairo false false)
400         _GTK2_FIND_INCLUDE_DIR(GTK2_PANGO_INCLUDE_DIR pango/pango.h)
401         _GTK2_FIND_LIBRARY    (GTK2_PANGO_LIBRARY pango false true)
403         _GTK2_FIND_INCLUDE_DIR(GTK2_ATK_INCLUDE_DIR atk/atk.h)
404         _GTK2_FIND_LIBRARY    (GTK2_ATK_LIBRARY atk false true)
406         #elseif(_GTK2_component STREQUAL "gdk_pixbuf")
407         #_GTK2_FIND_INCLUDE_DIR(GTK2_GDKPIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h)
408         #_GTK2_FIND_LIBRARY    (GTK2_GDKPIXBUF_LIBRARY gdk_pixbuf false true)
410     elseif(_GTK2_component STREQUAL "gtkmm")
412         _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMM_INCLUDE_DIR glibmm.h)
413         _GTK2_FIND_INCLUDE_DIR(GTK2_GLIBMMCONFIG_INCLUDE_DIR glibmmconfig.h)
414         _GTK2_FIND_LIBRARY    (GTK2_GLIBMM_LIBRARY glibmm true true)
416         _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMM_INCLUDE_DIR gdkmm.h)
417         _GTK2_FIND_INCLUDE_DIR(GTK2_GDKMMCONFIG_INCLUDE_DIR gdkmmconfig.h)
418         _GTK2_FIND_LIBRARY    (GTK2_GDKMM_LIBRARY gdkmm true true)
420         _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMM_INCLUDE_DIR gtkmm.h)
421         _GTK2_FIND_INCLUDE_DIR(GTK2_GTKMMCONFIG_INCLUDE_DIR gtkmmconfig.h)
422         _GTK2_FIND_LIBRARY    (GTK2_GTKMM_LIBRARY gtkmm true true)
424         _GTK2_FIND_INCLUDE_DIR(GTK2_CAIROMM_INCLUDE_DIR cairomm/cairomm.h)
425         _GTK2_FIND_LIBRARY    (GTK2_CAIROMM_LIBRARY cairomm true true)
427         _GTK2_FIND_INCLUDE_DIR(GTK2_PANGOMM_INCLUDE_DIR pangomm.h)
428         _GTK2_FIND_LIBRARY    (GTK2_PANGOMM_LIBRARY pangomm true true)
430         _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++_INCLUDE_DIR sigc++/sigc++.h)
431         _GTK2_FIND_INCLUDE_DIR(GTK2_SIGC++CONFIG_INCLUDE_DIR sigc++config.h)
432         _GTK2_FIND_LIBRARY    (GTK2_SIGC++_LIBRARY sigc true true)
434         _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMM_INCLUDE_DIR giomm.h)
435         _GTK2_FIND_INCLUDE_DIR(GTK2_GIOMMCONFIG_INCLUDE_DIR giommconfig.h)
436         _GTK2_FIND_LIBRARY    (GTK2_GIOMM_LIBRARY giomm true true)
438         _GTK2_FIND_INCLUDE_DIR(GTK2_ATKMM_INCLUDE_DIR atkmm.h)
439         _GTK2_FIND_LIBRARY    (GTK2_ATKMM_LIBRARY atkmm true true)
441     elseif(_GTK2_component STREQUAL "glade")
443         _GTK2_FIND_INCLUDE_DIR(GTK2_GLADE_INCLUDE_DIR glade/glade.h)
444         _GTK2_FIND_LIBRARY    (GTK2_GLADE_LIBRARY glade false true)
445     
446     elseif(_GTK2_component STREQUAL "glademm")
448         _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMM_INCLUDE_DIR libglademm.h)
449         _GTK2_FIND_INCLUDE_DIR(GTK2_GLADEMMCONFIG_INCLUDE_DIR libglademmconfig.h)
450         _GTK2_FIND_LIBRARY    (GTK2_GLADEMM_LIBRARY glademm true true)
452     else()
453         message(FATAL_ERROR "Unknown GTK2 component ${_component}")
454     endif()
455 endforeach()
458 # Solve for the GTK2 version if we haven't already
460 if(NOT GTK2_FIND_VERSION AND GTK2_GTK_INCLUDE_DIR)
461     _GTK2_GET_VERSION(GTK2_MAJOR_VERSION
462                       GTK2_MINOR_VERSION
463                       GTK2_PATCH_VERSION
464                       ${GTK2_GTK_INCLUDE_DIR}/gtk/gtkversion.h)
465     set(GTK2_VERSION ${GTK2_MAJOR_VERSION}.${GTK2_MINOR_VERSION}.${GTK2_PATCH_VERSION})
466 endif()
469 # Try to enforce components
472 set(_GTK2_did_we_find_everything true)  # This gets set to GTK2_FOUND
474 include(FindPackageHandleStandardArgs)
476 foreach(_GTK2_component ${GTK2_FIND_COMPONENTS})
477     string(TOUPPER ${_GTK2_component} _COMPONENT_UPPER)
479     if(_GTK2_component STREQUAL "gtk")
480         FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtk libraries were not found."
481             GTK2_GTK_LIBRARY
482             GTK2_GTK_INCLUDE_DIR
484             GTK2_GLIB_INCLUDE_DIR
485             GTK2_GLIBCONFIG_INCLUDE_DIR
486             GTK2_GLIB_LIBRARY
488             GTK2_GDK_INCLUDE_DIR
489             GTK2_GDKCONFIG_INCLUDE_DIR
490             GTK2_GDK_LIBRARY
491         )
492     elseif(_GTK2_component STREQUAL "gtkmm")
493         FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "Some or all of the gtkmm libraries were not found."
494             GTK2_GTKMM_LIBRARY
495             GTK2_GTKMM_INCLUDE_DIR
496             GTK2_GTKMMCONFIG_INCLUDE_DIR
498             GTK2_GLIBMM_INCLUDE_DIR
499             GTK2_GLIBMMCONFIG_INCLUDE_DIR
500             GTK2_GLIBMM_LIBRARY
502             GTK2_GDKMM_INCLUDE_DIR
503             GTK2_GDKMMCONFIG_INCLUDE_DIR
504             GTK2_GDKMM_LIBRARY
505         )
506     elseif(_GTK2_component STREQUAL "glade")
507         FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glade library was not found."
508             GTK2_GLADE_LIBRARY
509             GTK2_GLADE_INCLUDE_DIR
510         )
511     elseif(_GTK2_component STREQUAL "glademm")
512         FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTK2_${_COMPONENT_UPPER} "The glademm library was not found."
513             GTK2_GLADEMM_LIBRARY
514             GTK2_GLADEMM_INCLUDE_DIR
515             GTK2_GLADEMMCONFIG_INCLUDE_DIR
516         )
517     endif()
519     if(NOT GTK2_${_COMPONENT_UPPER}_FOUND)
520         set(_GTK2_did_we_find_everything false)
521     endif()
522 endforeach()
524 if(_GTK2_did_we_find_everything AND NOT GTK2_VERSION_CHECK_FAILED)
525     set(GTK2_FOUND true)
526 else()
527     # Unset our variables.
528     set(GTK2_FOUND false)
529     set(GTK2_VERSION)
530     set(GTK2_VERSION_MAJOR)
531     set(GTK2_VERSION_MINOR)
532     set(GTK2_VERSION_PATCH)
533     set(GTK2_INCLUDE_DIRS)
534     set(GTK2_LIBRARIES)
535 endif()
537 if(GTK2_INCLUDE_DIRS)
538    list(REMOVE_DUPLICATES GTK2_INCLUDE_DIRS)
539 endif()