Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[d8b982]: cmake / modules / FindGLIB.cmake Maximize Restore History

Download this file

FindGLIB.cmake    297 lines (257 with data), 7.2 kB

  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
# - Try to find GLib2
# Once done this will define
#
# GLIB2_FOUND - system has GLib2
# GLIB2_INCLUDE_DIRS - the GLib2 include directory
# GLIB2_LIBRARIES - Link these to use GLib2
# GLIB2_DEFINITIONS - Compiler switches required for using GLib2
# GLIB2_LINK_FLAGS - Link flags
#
# Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
# Copyright (c) 2006 Philippe Bernery <philippe.bernery@gmail.com>
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS AND GLIB2_PUBLIC_LINK_FLAGS)
# in cache already
set(GLIB2_FOUND TRUE)
else (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS AND GLIB2_PUBLIC_LINK_FLAGS)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
include(UsePkgConfig)
## Glib
pkgconfig(glib-2.0 _GLIB2IncDir _GLIB2LinkDir _GLIB2LinkFlags _GLIB2Cflags)
find_path(GLIBCONFIG_INCLUDE_DIR
NAMES
glibconfig.h
PATHS
${_GLIB2IncDir}
/opt/gnome/lib64/glib-2.0/include
/opt/gnome/lib/glib-2.0/include
/opt/lib/glib-2.0/include
/opt/local/lib/glib-2.0/include
/sw/lib/glib-2.0/include
/usr/lib64/glib-2.0/include
/usr/lib/glib-2.0/include
/usr/lib/i386-linux-gnu/glib-2.0/include
/usr/lib/x86_64-linux-gnu/glib-2.0/include
)
set(GLIB2_DEFINITIONS ${_GLIB2Cflags})
find_path(GLIB2_INCLUDE_DIR
NAMES
glib.h
PATHS
${_GLIB2IncDir}
/opt/gnome/include/glib-2.0
/opt/local/include/glib-2.0
/sw/include/glib-2.0
/usr/include/glib-2.0
/usr/local/include/glib-2.0
)
find_library(GLIB2_LIBRARY
NAMES
glib-2.0
PATHS
${_GLIB2LinkDir}
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/lib
/usr/local/lib
)
##
## GModule
pkgconfig(gmodule-2.0 _GMODULE2IncDir _GMODULE2LinkDir _GMODULE2LinkFlags _GMODULE2Cflags)
set(GMODULE2_DEFINITIONS ${_GMODULE2Cflags})
find_path(GMODULE2_INCLUDE_DIR
NAMES
gmodule.h
PATHS
${_GMODULE2IncDir}
/opt/gnome/include/glib-2.0
/opt/local/include/glib-2.0
/sw/include/glib-2.0
/usr/include/glib-2.0
/usr/local/include/glib-2.0
)
find_library(GMODULE2_LIBRARY
NAMES
gmodule-2.0
PATHS
${_GMODULE2LinkDir}
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/lib
/usr/local/lib
)
if (GMODULE2_LIBRARY AND GMODULE2_INCLUDE_DIR)
set(GMODULE2_FOUND TRUE)
endif (GMODULE2_LIBRARY AND GMODULE2_INCLUDE_DIR)
##
## GThread
pkgconfig(gthread-2.0 _GTHREAD2IncDir _GTHREAD2LinkDir _GTHREAD2LinkFlags _GTHREAD2Cflags)
set(GTHREAD2_DEFINITIONS ${_GTHREAD2Cflags})
find_path(GTHREAD2_INCLUDE_DIR
NAMES
gthread.h
PATHS
${_GTHREAD2IncDir}
/opt/gnome/include/glib-2.0
/opt/local/include/glib-2.0
/sw/include/glib-2.0
/usr/include/glib-2.0
/usr/local/include/glib-2.0
PATH_SUFFIXES
glib
)
find_library(GTHREAD2_LIBRARY
NAMES
gthread-2.0
PATHS
${_GTHREAD2LinkDir}
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/lib
/usr/local/lib
)
if (GTHREAD2_LIBRARY AND GTHREAD2_INCLUDE_DIR)
set(GTHREAD2_FOUND TRUE)
endif (GTHREAD2_LIBRARY AND GTHREAD2_INCLUDE_DIR)
##
## GObject
pkgconfig(gobject-2.0 _GOBJECT2IncDir _GOBJECT2LinkDir _GOBJECT2LinkFlags _GOBJECT2Cflags)
set(GOBJECT2_DEFINITIONS ${_GOBJECT2Cflags})
find_path(GOBJECT2_INCLUDE_DIR
NAMES
gobject.h
PATHS
${_GOBJECT2IncDir}
/opt/gnome/include/glib-2.0
/opt/local/include/glib-2.0
/sw/include/glib-2.0
/usr/include/glib-2.0
/usr/local/include/glib-2.0
PATH_SUFFIXES
gobject
)
find_library(GOBJECT2_LIBRARY
NAMES
gobject-2.0
PATHS
${_GOBJECT2LinkDir}
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/lib
/usr/local/lib
)
if (GOBJECT2_LIBRARY AND GOBJECT2_INCLUDE_DIR)
set(GOBJECT2_FOUND TRUE)
endif (GOBJECT2_LIBRARY AND GOBJECT2_INCLUDE_DIR)
##
## libintl
find_path(LIBINTL_INCLUDE_DIR
NAMES
libintl.h
NO_DEFAULT_PATH
PATHS
/opt/gnome/include/glib-2.0
/opt/local/include/glib-2.0
/opt/local/include
/sw/include
/usr/include/glib-2.0
/usr/local/include/glib-2.0
)
find_library(LIBINTL_LIBRARY
NAMES
intl
NO_DEFAULT_PATH
PATHS
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/local/lib
/usr/lib
)
if (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR)
set(LIBINTL_FOUND TRUE)
endif (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR)
##
## libiconv
find_path(LIBICONV_INCLUDE_DIR
NAMES
iconv.h
NO_DEFAULT_PATH
PATHS
/opt/gnome/include/glib-2.0
/opt/local/include/glib-2.0
/opt/local/include
/sw/include
/sw/include/glib-2.0
/usr/local/include/glib-2.0
/usr/include/glib-2.0
)
find_library(LIBICONV_LIBRARY
NAMES
iconv
NO_DEFAULT_PATH
PATHS
/opt/gnome/lib
/opt/local/lib
/sw/lib
/usr/lib
/usr/local/lib
)
if (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR)
set(LIBICONV_FOUND TRUE)
endif (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR)
##
set(GLIB2_INCLUDE_DIRS
${GLIB2_INCLUDE_DIR}
${GLIBCONFIG_INCLUDE_DIR}
)
set(GLIB2_LIBRARIES
${GLIB2_LIBRARY}
)
set(GLIB2_PUBLIC_LINK_FLAGS
${_GLIB2LinkFlags} ${_GMODULE2LinkFlags} ${_GTHREAD2LinkFlags}
)
if (GMODULE2_FOUND)
set(GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${GMODULE2_LIBRARY})
set(GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${GMODULE2_INCLUDE_DIR})
endif (GMODULE2_FOUND)
if (GTHREAD2_FOUND)
set(GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${GTHREAD2_LIBRARY})
set(GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${GTHREAD2_INCLUDE_DIR})
endif (GTHREAD2_FOUND)
if (GOBJECT2_FOUND)
set(GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARY})
set(GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${GOBJECT2_INCLUDE_DIR})
endif (GOBJECT2_FOUND)
if (LIBINTL_FOUND)
set(GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBINTL_LIBRARY})
set(GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBINTL_INCLUDE_DIR})
endif (LIBINTL_FOUND)
if (LIBICONV_FOUND)
set(GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY})
set(GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR})
endif (LIBICONV_FOUND)
if (GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES)
set(GLIB2_FOUND TRUE)
endif (GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES)
if (GLIB2_FOUND)
if (NOT GLIB2_FIND_QUIETLY)
message(STATUS "Found GLib2: ${GLIB2_LIBRARIES}")
endif (NOT GLIB2_FIND_QUIETLY)
else (GLIB2_FOUND)
if (GLIB2_FIND_REQUIRED)
message(FATAL_ERROR "Could not find GLib2")
endif (GLIB2_FIND_REQUIRED)
endif (GLIB2_FOUND)
# show the GLIB2_INCLUDE_DIRS and GLIB2_LIBRARIES variables only in the advanced view
mark_as_advanced(GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES GLIB2_PUBLIC_LINK_FLAGS)
endif (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS AND GLIB2_PUBLIC_LINK_FLAGS)