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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
|
Index: cmake/modules/MacroFindOptionalDep.cmake
===================================================================
--- cmake/modules/MacroFindOptionalDep.cmake (revision 0)
+++ cmake/modules/MacroFindOptionalDep.cmake (revision 0)
@@ -0,0 +1,268 @@
+# FIND_OPTIONAL_DEP macro implements two typical optional dependency handling
+# approaches:
+#
+# Best-effort approach(FORCE_DEPS=OFF):
+# Link to all enabled optional dependencies if found. Turn off not found
+# ones, and keep compiling. This greatly benefits hand-compiling from source
+# if all suggested dependencies are turned on by default. Newly installed
+# software conveniently integrates with whatever environment it's compiled in.
+#
+# Strict dependencies approach(FORCE_DEPS=ON):
+# All enabled optional dependencies must be found, or compilation aborts.
+# This approach lets request and ensure specific functionality. The compilation
+# is deterministic in the sense that everything that's requested is provided
+# or the process fails. This is the preferred behaviour for automated building
+# by package managers/distro maintainers.
+#
+# Parameters:
+# _package: the package to load
+# _found: the name of *_FOUND variable which is set by find_package()
+# if ${_package} is found.
+# _enabled: option/variable name which along with FORCE_DEPS options
+# controls macro behaviour:
+# ${_enabled} FORCE_DEPS Behaviour
+# OFF any ${_package} is not loaded
+# ON ON Try loading ${_package}. If package is
+# not found, abort(fatal error).
+# ON OFF Try loading ${_package}. If package is
+# not found, continue.
+# _description: a short description of features provided by ${_package}.
+# Used to display human-readable diagnostic messages
+
+# macro name changed from FIND_OPTIONAL_PACKAGE to FIND_OPTIONAL_DEP due to
+# clash with a macro from KDE4
+
+# if ON, requested optional deps become required
+# if OFF, requested optional deps are linked to if found
+
+OPTION(FORCE_DEPS "Enforce strict dependencies" OFF)
+
+macro(FIND_OPTIONAL_DEP _package _enabled _found _description)
+
+ if(${_enabled})
+ if(FORCE_DEPS)
+ find_package(${_package} REQUIRED)
+ else(FORCE_DEPS)
+ find_package(${_package})
+ endif(FORCE_DEPS)
+ endif(${_enabled})
+
+ REPORT_OPTIONAL_PACKAGE_STATUS(${_package} ${_enabled} ${_found} ${_description})
+
+endmacro(FIND_OPTIONAL_DEP)
+
+
+macro(REPORT_OPTIONAL_PACKAGE_STATUS _package _enabled _found _description)
+
+ if(${_enabled})
+ if(${_found})
+ MESSAGE("** ${_package} is found. Support for ${_description} is enabled")
+ else(${_found})
+ MESSAGE("** ${_package} not found. Support for ${_description} is disabled")
+ endif(${_found})
+ else(${_enabled})
+ MESSAGE("** ${_package} is disabled. No support for ${_description}")
+ endif(${_enabled})
+
+endmacro(REPORT_OPTIONAL_PACKAGE_STATUS)
+# FIND_OPTIONAL_DEP macro implements two typical optional dependency handling
+# approaches:
+#
+# Best-effort approach(FORCE_DEPS=OFF):
+# Link to all enabled optional dependencies if found. Turn off not found
+# ones, and keep compiling. This greatly benefits hand-compiling from source
+# if all suggested dependencies are turned on by default. Newly installed
+# software conveniently integrates with whatever environment it's compiled in.
+#
+# Strict dependencies approach(FORCE_DEPS=ON):
+# All enabled optional dependencies must be found, or compilation aborts.
+# This approach lets request and ensure specific functionality. The compilation
+# is deterministic in the sense that everything that's requested is provided
+# or the process fails. This is the preferred behaviour for automated building
+# by package managers/distro maintainers.
+#
+# Parameters:
+# _package: the package to load
+# _found: the name of *_FOUND variable which is set by find_package()
+# if ${_package} is found.
+# _enabled: option/variable name which along with FORCE_DEPS options
+# controls macro behaviour:
+# ${_enabled} FORCE_DEPS Behaviour
+# OFF any ${_package} is not loaded
+# ON ON Try loading ${_package}. If package is
+# not found, abort(fatal error).
+# ON OFF Try loading ${_package}. If package is
+# not found, continue.
+# _description: a short description of features provided by ${_package}.
+# Used to display human-readable diagnostic messages
+
+# macro name changed from FIND_OPTIONAL_PACKAGE to FIND_OPTIONAL_DEP due to
+# clash with a macro from KDE4
+
+# if ON, requested optional deps become required
+# if OFF, requested optional deps are linked to if found
+
+OPTION(FORCE_DEPS "Enforce strict dependencies" OFF)
+
+macro(FIND_OPTIONAL_DEP _package _enabled _found _description)
+
+ if(${_enabled})
+ if(FORCE_DEPS)
+ find_package(${_package} REQUIRED)
+ else(FORCE_DEPS)
+ find_package(${_package})
+ endif(FORCE_DEPS)
+ endif(${_enabled})
+
+ REPORT_OPTIONAL_PACKAGE_STATUS(${_package} ${_enabled} ${_found} ${_description})
+
+endmacro(FIND_OPTIONAL_DEP)
+
+
+macro(REPORT_OPTIONAL_PACKAGE_STATUS _package _enabled _found _description)
+
+ if(${_enabled})
+ if(${_found})
+ MESSAGE("** ${_package} is found. Support for ${_description} is enabled")
+ else(${_found})
+ MESSAGE("** ${_package} not found. Support for ${_description} is disabled")
+ endif(${_found})
+ else(${_enabled})
+ MESSAGE("** ${_package} is disabled. No support for ${_description}")
+ endif(${_enabled})
+
+endmacro(REPORT_OPTIONAL_PACKAGE_STATUS)
+# FIND_OPTIONAL_DEP macro implements two typical optional dependency handling
+# approaches:
+#
+# Best-effort approach(FORCE_DEPS=OFF):
+# Link to all enabled optional dependencies if found. Turn off not found
+# ones, and keep compiling. This greatly benefits hand-compiling from source
+# if all suggested dependencies are turned on by default. Newly installed
+# software conveniently integrates with whatever environment it's compiled in.
+#
+# Strict dependencies approach(FORCE_DEPS=ON):
+# All enabled optional dependencies must be found, or compilation aborts.
+# This approach lets request and ensure specific functionality. The compilation
+# is deterministic in the sense that everything that's requested is provided
+# or the process fails. This is the preferred behaviour for automated building
+# by package managers/distro maintainers.
+#
+# Parameters:
+# _package: the package to load
+# _found: the name of *_FOUND variable which is set by find_package()
+# if ${_package} is found.
+# _enabled: option/variable name which along with FORCE_DEPS options
+# controls macro behaviour:
+# ${_enabled} FORCE_DEPS Behaviour
+# OFF any ${_package} is not loaded
+# ON ON Try loading ${_package}. If package is
+# not found, abort(fatal error).
+# ON OFF Try loading ${_package}. If package is
+# not found, continue.
+# _description: a short description of features provided by ${_package}.
+# Used to display human-readable diagnostic messages
+
+# macro name changed from FIND_OPTIONAL_PACKAGE to FIND_OPTIONAL_DEP due to
+# clash with a macro from KDE4
+
+# if ON, requested optional deps become required
+# if OFF, requested optional deps are linked to if found
+
+OPTION(FORCE_DEPS "Enforce strict dependencies" OFF)
+
+macro(FIND_OPTIONAL_DEP _package _enabled _found _description)
+
+ if(${_enabled})
+ if(FORCE_DEPS)
+ find_package(${_package} REQUIRED)
+ else(FORCE_DEPS)
+ find_package(${_package})
+ endif(FORCE_DEPS)
+ endif(${_enabled})
+
+ REPORT_OPTIONAL_PACKAGE_STATUS(${_package} ${_enabled} ${_found} ${_description})
+
+endmacro(FIND_OPTIONAL_DEP)
+
+
+macro(REPORT_OPTIONAL_PACKAGE_STATUS _package _enabled _found _description)
+
+ if(${_enabled})
+ if(${_found})
+ MESSAGE("** ${_package} is found. Support for ${_description} is enabled")
+ else(${_found})
+ MESSAGE("** ${_package} not found. Support for ${_description} is disabled")
+ endif(${_found})
+ else(${_enabled})
+ MESSAGE("** ${_package} is disabled. No support for ${_description}")
+ endif(${_enabled})
+
+endmacro(REPORT_OPTIONAL_PACKAGE_STATUS)
+# FIND_OPTIONAL_DEP macro implements two typical optional dependency handling
+# approaches:
+#
+# Best-effort approach(FORCE_DEPS=OFF):
+# Link to all enabled optional dependencies if found. Turn off not found
+# ones, and keep compiling. This greatly benefits hand-compiling from source
+# if all suggested dependencies are turned on by default. Newly installed
+# software conveniently integrates with whatever environment it's compiled in.
+#
+# Strict dependencies approach(FORCE_DEPS=ON):
+# All enabled optional dependencies must be found, or compilation aborts.
+# This approach lets request and ensure specific functionality. The compilation
+# is deterministic in the sense that everything that's requested is provided
+# or the process fails. This is the preferred behaviour for automated building
+# by package managers/distro maintainers.
+#
+# Parameters:
+# _package: the package to load
+# _found: the name of *_FOUND variable which is set by find_package()
+# if ${_package} is found.
+# _enabled: option/variable name which along with FORCE_DEPS options
+# controls macro behaviour:
+# ${_enabled} FORCE_DEPS Behaviour
+# OFF any ${_package} is not loaded
+# ON ON Try loading ${_package}. If package is
+# not found, abort(fatal error).
+# ON OFF Try loading ${_package}. If package is
+# not found, continue.
+# _description: a short description of features provided by ${_package}.
+# Used to display human-readable diagnostic messages
+
+# macro name changed from FIND_OPTIONAL_PACKAGE to FIND_OPTIONAL_DEP due to
+# clash with a macro from KDE4
+
+# if ON, requested optional deps become required
+# if OFF, requested optional deps are linked to if found
+
+OPTION(FORCE_DEPS "Enforce strict dependencies" OFF)
+
+macro(FIND_OPTIONAL_DEP _package _enabled _found _description)
+
+ if(${_enabled})
+ if(FORCE_DEPS)
+ find_package(${_package} REQUIRED)
+ else(FORCE_DEPS)
+ find_package(${_package})
+ endif(FORCE_DEPS)
+ endif(${_enabled})
+
+ REPORT_OPTIONAL_PACKAGE_STATUS(${_package} ${_enabled} ${_found} ${_description})
+
+endmacro(FIND_OPTIONAL_DEP)
+
+
+macro(REPORT_OPTIONAL_PACKAGE_STATUS _package _enabled _found _description)
+
+ if(${_enabled})
+ if(${_found})
+ MESSAGE("** ${_package} is found. Support for ${_description} is enabled")
+ else(${_found})
+ MESSAGE("** ${_package} not found. Support for ${_description} is disabled")
+ endif(${_found})
+ else(${_enabled})
+ MESSAGE("** ${_package} is disabled. No support for ${_description}")
+ endif(${_enabled})
+
+endmacro(REPORT_OPTIONAL_PACKAGE_STATUS)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 917610)
+++ CMakeLists.txt (working copy)
@@ -24,9 +24,13 @@
# properly set up compile flags (QT_DEBUG/QT_NO_DEBUG, ...)
include(${QT_USE_FILE})
-find_package(Redland)
+include(MacroFindOptionalDep)
-find_package(CLucene)
+option(ENABLE_Redland "Raptor RDF parser/serializer and Redland storage backend" OFF)
+find_optional_dep(Redland ENABLE_Redland REDLAND_FOUND "Raptor RDF parser/serializer and Redland storage backend")
+
+option(ENABLE_CLucene "CLucene-based full-text search index library" ON)
+find_optional_dep(CLucene ENABLE_CLucene CLucene_FOUND "CLucene-based full-text search index library")
if(CLucene_FOUND)
if(CLUCENE_VERSION AND CLUCENE_VERSION STRGREATER "0.9.19" OR CLUCENE_VERSION STREQUAL "0.9.19")
set(CL_VERSION_19_OR_GREATER TRUE)
@@ -34,23 +38,25 @@
set(SOPRANO_BUILD_INDEX_LIB 1 CACHE INTERNAL "Soprano Index is built" FORCE)
endif(CLucene_FOUND)
-find_package(JNI)
-if(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
- file(READ ${JAVA_INCLUDE_PATH}/jni.h jni_header_data)
- string(REGEX MATCH "JNI_VERSION_1_4" JNI_1_4_FOUND "${jni_header_data}")
- if(JNI_1_4_FOUND)
- message(STATUS "Found Java JNI >= 1.4: ${JAVA_INCLUDE_PATH}, ${JAVA_JVM_LIBRARY}")
- else(JNI_1_4_FOUND)
- message( "Need JNI version 1.4 or higher for the Sesame2 backend.")
- endif(JNI_1_4_FOUND)
-else(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
- message(STATUS "Could not find Java JNI")
- if("$ENV{JAVA_HOME}" STREQUAL "")
- message("Make sure JAVA_HOME is set")
- endif("$ENV{JAVA_HOME}" STREQUAL "")
-endif(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
+option(ENABLE_Sesame2 "Sesame2 storage backend (java-based)" ON)
+if(ENABLE_Sesame2)
+ find_package(JNI)
+ if(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
+ file(READ ${JAVA_INCLUDE_PATH}/jni.h jni_header_data)
+ string(REGEX MATCH "JNI_VERSION_1_4" JNI_1_4_FOUND "${jni_header_data}")
+ if(JNI_1_4_FOUND)
+ message(STATUS "Found Java JNI >= 1.4: ${JAVA_INCLUDE_PATH}, ${JAVA_JVM_LIBRARY}")
+ else(JNI_1_4_FOUND)
+ message( "Need JNI version 1.4 or higher for the Sesame2 backend.")
+ endif(JNI_1_4_FOUND)
+ else(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
+ message(STATUS "Could not find Java JNI")
+ if("$ENV{JAVA_HOME}" STREQUAL "")
+ message("Make sure JAVA_HOME is set")
+ endif("$ENV{JAVA_HOME}" STREQUAL "")
+ endif(JAVA_INCLUDE_PATH AND JAVA_JVM_LIBRARY)
+endif(ENABLE_Sesame2)
-
################## setup install directories ################################
set (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
set (LIB_DESTINATION "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE STRING "Library directory name")
|