-
Notifications
You must be signed in to change notification settings - Fork 467
/
Copy pathFindGTK3.cmake
125 lines (87 loc) · 3.06 KB
/
FindGTK3.cmake
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
# Taken from: Remmina - The GTK+ Remote Desktop Client
#
# Copyright (C) 2011 Marc-Andre Moreau
#
# This program 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.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330,
# Boston, MA 02111-1307, USA.
find_package(PkgConfig)
set(_GTK3_found_all true)
# Gtk
pkg_check_modules(PC_GTK3 gtk+-3.0)
if(NOT PC_GTK3_FOUND)
set(_GTK3_found_all false)
endif()
find_path(GTK3_INCLUDE_DIR NAMES gtk/gtk.h
PATH_SUFFIXES gtk-3.0)
find_library(GTK3_LIBRARY NAMES gtk-3)
# Gdk
find_library(GDK3_LIBRARY NAMES gdk-3)
# Gdk-Pixbuf
pkg_check_modules(PC_GDKPIXBUF gdk-pixbuf-2.0)
if(NOT PC_GDKPIXBUF_FOUND)
set(_GTK3_found_all false)
endif()
find_path(GDKPIXBUF_INCLUDE_DIR gdk-pixbuf/gdk-pixbuf.h
HINTS ${PC_GDKPIXBUF_INCLUDEDIR} ${PC_GDKPIXBUF_INCLUDE_DIRS}
PATH_SUFFIXES gdk-pixbuf-2.0)
find_library(GDKPIXBUF_LIBRARY NAMES gdk_pixbuf-2.0
HINTS ${PC_GDKPIXBUF_LIBDIR} ${PC_GDKPIXBUF_LIBRARY_DIRS})
# Glib
find_package(GLIB2)
if(NOT GLIB2_FOUND)
set(_GTK3_found_all false)
endif()
# Pango
pkg_check_modules(PC_PANGO pango)
if(NOT PC_PANGO_FOUND)
set(_GTK3_found_all false)
endif()
find_path(PANGO_INCLUDE_DIR pango/pango.h
HINTS ${PC_PANGO_INCLUDEDIR} ${PC_PANGO_INCLUDE_DIRS}
PATH_SUFFIXES pango-1.0)
find_library(PANGO_LIBRARY NAMES pango-1.0
HINTS ${PC_PANGO_LIBDIR} ${PC_PANGO_LIBRARY_DIRS})
# Cairo
set(CAIRO_DEFINITIONS ${PC_CAIRO_CXXFLAGS_OTHER})
find_path(CAIRO_INCLUDE_DIR cairo.h
HINTS ${PC_CAIRO_INCLUDEDIR} ${PC_CAIRO_INCLUDE_DIRS}
PATH_SUFFIXES cairo)
find_library(CAIRO_LIBRARY NAMES cairo
HINTS ${PC_CAIRO_LIBDIR} ${PC_CAIRO_LIBRARY_DIRS})
# Atk
pkg_check_modules(PC_ATK atk)
if(NOT PC_ATK_FOUND)
set(_GTK3_found_all false)
endif()
find_path(ATK_INCLUDE_DIR atk/atk.h
HINTS ${PC_ATK_INCLUDEDIR} ${PC_ATK_INCLUDE_DIRS}
PATH_SUFFIXES atk-1.0)
find_library(ATK_LIBRARY NAMES atk-1.0
HINTS ${PC_ATK_LIBDIR} ${PC_ATK_LIBRARY_DIRS})
# Finalize
if(_GTK3_found_all)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GTK3 DEFAULT_MSG GTK3_LIBRARY GTK3_INCLUDE_DIR)
set(GTK3_LIBRARIES ${GTK3_LIBRARY} ${GDK3_LIBRARY} ${GLIB2_LIBRARIES} ${PANGO_LIBRARY} ${CAIRO_LIBRARY} ${GDKPIXBUF_LIBRARY} ${ATK_LIBRARY})
set(GTK3_INCLUDE_DIRS ${GTK3_INCLUDE_DIR} ${GLIB2_INCLUDE_DIRS} ${PANGO_INCLUDE_DIR} ${CAIRO_INCLUDE_DIR} ${GDKPIXBUF_INCLUDE_DIR} ${ATK_INCLUDE_DIR})
mark_as_advanced(GTK3_INCLUDE_DIR GTK3_LIBRARY)
set(GTK3_FOUND true)
else()
unset(GTK3_LIBRARY)
unset(GTK3_INCLUDE_DIR)
unset(GDK3_LIBRARY)
unset(GDK3_INCLUDE_DIR)
set(GTK3_FOUND false)
endif()