On this page
FindGTK2
Find the GTK2 widget libraries and several of its other optional components like gtkmm, glade, and glademm.
Specify one or more of the following components as you call this find module. See example below.
gtkgtkmmgladeglademm
Imported Targets
This module defines the following IMPORTED targets (subject to component selection):
GTK2::atk, GTK2::atkmm, GTK2::cairo, GTK2::cairomm, GTK2::gdk_pixbuf, GTK2::gdk, GTK2::gdkmm, GTK2::gio, GTK2::giomm, GTK2::glade, GTK2::glademm, GTK2::glib, GTK2::glibmm, GTK2::gmodule, GTK2::gobject, GTK2::gthread, GTK2::gtk, GTK2::gtkmm, GTK2::harfbuzz, GTK2::pango, GTK2::pangocairo, GTK2::pangoft2, GTK2::pangomm, GTK2::pangoxft, GTK2::sigc.
New in version 3.16.7: Added the GTK2::harfbuzz target.
Result Variables
The following variables will be defined for your use
GTK2_FOUND- 
    
Were all of your specified components found?
 GTK2_INCLUDE_DIRS- 
    
All include directories
 GTK2_LIBRARIES- 
    
All libraries
 GTK2_TARGETS- 
    
New in version 3.5: All imported targets
 GTK2_DEFINITIONS- 
    
Additional compiler flags
 GTK2_VERSION- 
    
The version of GTK2 found (x.y.z)
 GTK2_MAJOR_VERSION- 
    
The major version of GTK2
 GTK2_MINOR_VERSION- 
    
The minor version of GTK2
 GTK2_PATCH_VERSION- 
    
The patch version of GTK2
 
New in version 3.5: When GTK2_USE_IMPORTED_TARGETS is set to TRUE, GTK2_LIBRARIES will list imported targets instead of library paths.
Input Variables
Optional variables you can define prior to calling this module:
GTK2_DEBUG- 
    
Enables verbose debugging of the module
 GTK2_ADDITIONAL_SUFFIXES- 
    
Allows defining additional directories to search for include files
 
Example Usage
Call find_package() once. Here are some examples to pick from:
Require GTK 2.6 or later:
find_package(GTK2 2.6 REQUIRED gtk)
  Require GTK 2.10 or later and Glade:
find_package(GTK2 2.10 REQUIRED gtk glade)
  Search for GTK/GTKMM 2.8 or later:
find_package(GTK2 2.8 COMPONENTS gtk gtkmm)
  Use the results:
if(GTK2_FOUND)
  include_directories(${GTK2_INCLUDE_DIRS})
  add_executable(mygui mygui.cc)
  target_link_libraries(mygui ${GTK2_LIBRARIES})
endif()
  © 2000–2022 Kitware, Inc. and Contributors
Licensed under the BSD 3-clause License.
 https://cmake.org/cmake/help/v3.23/module/FindGTK2.html