forked from openSUSE/libsolv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
488 lines (417 loc) · 16.3 KB
/
CMakeLists.txt
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
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
PROJECT (libsolv)
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.5)
OPTION (ENABLE_STATIC "Build a static version of the libraries?" OFF)
OPTION (DISABLE_SHARED "Do not build a shared version of the libraries?" OFF)
OPTION (ENABLE_PERL "Build the perl bindings?" OFF)
OPTION (ENABLE_PYTHON "Build the python bindings?" OFF)
OPTION (ENABLE_RUBY "Build the ruby bindings?" OFF)
OPTION (ENABLE_TCL "Build the Tcl bindings?" OFF)
OPTION (USE_VENDORDIRS "Install the bindings in vendor directories?" OFF)
OPTION (ENABLE_RPMDB "Build with rpm database support?" OFF)
OPTION (ENABLE_RPMPKG "Build with rpm package support?" OFF)
OPTION (ENABLE_PUBKEY "Build with pubkey support?" OFF)
OPTION (ENABLE_RPMDB_BYRPMHEADER "Build with rpmdb Header support?" OFF)
OPTION (ENABLE_RPMDB_LIBRPM "Use librpm to access the rpm database?" OFF)
OPTION (ENABLE_RPMDB_BDB "Use BerkeleyDB to access the rpm database?" OFF)
OPTION (ENABLE_RPMPKG_LIBRPM "Use librpm to access rpm header information?" OFF)
OPTION (ENABLE_RPMMD "Build with rpmmd repository support?" OFF)
OPTION (ENABLE_SUSEREPO "Build with suse repository support?" OFF)
OPTION (ENABLE_COMPS "Build with fedora comps support?" OFF)
OPTION (ENABLE_HELIXREPO "Build with helix repository support?" OFF)
OPTION (ENABLE_DEBIAN "Build with debian database/repository support?" OFF)
OPTION (ENABLE_MDKREPO "Build with mandriva/mageia repository support?" OFF)
OPTION (ENABLE_ARCHREPO "Build with archlinux repository support?" OFF)
OPTION (ENABLE_CUDFREPO "Build with cudf repository support?" OFF)
OPTION (ENABLE_HAIKU "Build with Haiku package support?" OFF)
OPTION (ENABLE_CONDA "Build with conda dependency support?" OFF)
OPTION (ENABLE_APPDATA "Build with AppStream appdata support?" OFF)
OPTION (MULTI_SEMANTICS "Build with support for multiple distribution types?" OFF)
OPTION (ENABLE_LZMA_COMPRESSION "Build with lzma/xz compression support?" OFF)
OPTION (ENABLE_BZIP2_COMPRESSION "Build with bzip2 compression support?" OFF)
OPTION (ENABLE_ZSTD_COMPRESSION "Build with zstd compression support?" OFF)
OPTION (ENABLE_ZCHUNK_COMPRESSION "Build with zchunk compression support?" OFF)
OPTION (WITH_SYSTEM_ZCHUNK "Use system zchunk library?" OFF)
OPTION (WITH_LIBXML2 "Build with libxml2 instead of libexpat?" OFF)
OPTION (WITHOUT_COOKIEOPEN "Disable the use of stdio cookie opens?" OFF)
include (GNUInstallDirs)
message (STATUS "Libraries will be installed in ${CMAKE_INSTALL_FULL_LIBDIR}")
message (STATUS "Header files will be installed in ${CMAKE_INSTALL_FULL_INCLUDEDIR}")
message (STATUS "Binaries will be installed in ${CMAKE_INSTALL_FULL_BINDIR}")
message (STATUS "Man pages will be installed in ${CMAKE_INSTALL_FULL_MANDIR}")
IF (NOT PKGCONFIG_INSTALL_DIR)
SET (PKGCONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
ENDIF (NOT PKGCONFIG_INSTALL_DIR)
####################################################################
# CONFIGURATION #
####################################################################
# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
SET (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
INSTALL( FILES ${CMAKE_MODULE_PATH}/FindLibSolv.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules )
# for shared libraries on windows (DLLs), we just export all symbols for now
SET(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
INCLUDE (${CMAKE_SOURCE_DIR}/VERSION.cmake)
SET (have_system x)
IF (FEDORA)
MESSAGE(STATUS "Building for Fedora")
ADD_DEFINITIONS (-DFEDORA)
SET (ENABLE_RPMDB ON)
SET (ENABLE_RPMMD ON)
SET (have_system ${have_system}x)
ENDIF (FEDORA)
IF (DEBIAN)
MESSAGE (STATUS "Building for Debian")
ADD_DEFINITIONS (-DDEBIAN)
SET (ENABLE_DEBIAN ON)
SET (have_system ${have_system}x)
ENDIF (DEBIAN)
IF (SUSE)
MESSAGE (STATUS "Building for SUSE")
ADD_DEFINITIONS (-DSUSE)
SET (ENABLE_RPMDB ON)
SET (ENABLE_PUBKEY ON)
SET (ENABLE_RPMDB_BYRPMHEADER ON)
SET (ENABLE_RPMMD ON)
SET (ENABLE_SUSEREPO ON)
SET (ENABLE_HELIXREPO ON)
SET (ENABLE_LINKED_PKGS ON)
SET (have_system ${have_system}x)
ENDIF (SUSE)
IF (ARCHLINUX)
MESSAGE (STATUS "Building for Archlinux")
ADD_DEFINITIONS (-DARCHLINUX)
SET (ENABLE_ARCHREPO ON)
SET (have_system ${have_system}x)
ENDIF (ARCHLINUX)
IF (MANDRIVA)
MESSAGE (STATUS "Building for Mandriva")
ADD_DEFINITIONS (-DMANDRIVA)
SET (ENABLE_MDKREPO ON)
SET (ENABLE_RPMDB ON)
SET (have_system ${have_system}x)
ENDIF (MANDRIVA)
IF (MAGEIA)
MESSAGE (STATUS "Building for Mageia")
ADD_DEFINITIONS (-DMAGEIA)
SET (ENABLE_MDKREPO ON)
SET (ENABLE_RPMDB ON)
SET (ENABLE_RPMMD ON)
SET (ENABLE_LZMA_COMPRESSION ON)
SET (have_system ${have_system}x)
ENDIF (MAGEIA)
IF (HAIKU)
MESSAGE(STATUS "Building for Haiku")
FIND_LIBRARY(HAIKU_BE_LIBRARY NAMES be)
FIND_LIBRARY(HAIKU_NETWORK_LIBRARY NAMES network)
FIND_LIBRARY(HAIKU_PACKAGE_LIBRARY NAMES package)
SET (HAIKU_SYSTEM_LIBRARIES
${HAIKU_BE_LIBRARY} ${HAIKU_NETWORK_LIBRARY} ${HAIKU_PACKAGE_LIBRARY})
ADD_DEFINITIONS (-DHAIKU)
SET (ENABLE_HAIKU ON)
SET (have_system ${have_system}x)
ENDIF (HAIKU)
SET (CMAKE_MACOSX_RPATH ON)
IF (${have_system} STREQUAL x)
MESSAGE (STATUS "Building for no system")
ENDIF (${have_system} STREQUAL x)
IF (${have_system} STRGREATER xx)
MESSAGE (FATAL_ERROR "Can only compile for one system type.")
ENDIF (${have_system} STRGREATER xx)
SET (ENABLE_ZLIB_COMPRESSION ON)
IF (ENABLE_ARCHREPO OR ENABLE_DEBIAN)
SET (ENABLE_LZMA_COMPRESSION ON)
ENDIF (ENABLE_ARCHREPO OR ENABLE_DEBIAN)
IF (WITH_SYSTEM_ZCHUNK)
SET (ENABLE_ZCHUNK_COMPRESSION ON)
FIND_PACKAGE(PkgConfig REQUIRED)
PKG_CHECK_MODULES(ZCHUNK zck REQUIRED)
ENDIF (WITH_SYSTEM_ZCHUNK)
IF (ENABLE_ZCHUNK_COMPRESSION)
SET (ENABLE_ZSTD_COMPRESSION ON)
ENDIF (ENABLE_ZCHUNK_COMPRESSION)
IF (ENABLE_RPMMD OR ENABLE_SUSEREPO OR ENABLE_APPDATA OR ENABLE_COMPS OR ENABLE_HELIXREPO OR ENABLE_MDKREPO)
IF (WITH_LIBXML2 )
FIND_PACKAGE (LibXml2 REQUIRED)
INCLUDE_DIRECTORIES (${LIBXML2_INCLUDE_DIR})
ELSE(WITH_LIBXML2 )
FIND_PACKAGE (EXPAT REQUIRED)
INCLUDE_DIRECTORIES (${EXPAT_INCLUDE_DIRS})
ENDIF (WITH_LIBXML2 )
ENDIF (ENABLE_RPMMD OR ENABLE_SUSEREPO OR ENABLE_APPDATA OR ENABLE_COMPS OR ENABLE_HELIXREPO OR ENABLE_MDKREPO)
IF (ENABLE_ZLIB_COMPRESSION)
FIND_PACKAGE (ZLIB REQUIRED)
INCLUDE_DIRECTORIES (${ZLIB_INCLUDE_DIRS})
ENDIF (ENABLE_ZLIB_COMPRESSION)
IF (ENABLE_LZMA_COMPRESSION)
FIND_PACKAGE (LZMA REQUIRED)
INCLUDE_DIRECTORIES (${LZMA_INCLUDE_DIR})
ENDIF (ENABLE_LZMA_COMPRESSION)
IF (ENABLE_BZIP2_COMPRESSION)
FIND_PACKAGE (BZip2 REQUIRED)
INCLUDE_DIRECTORIES (${BZIP2_INCLUDE_DIRS})
ENDIF (ENABLE_BZIP2_COMPRESSION)
IF (ENABLE_ZSTD_COMPRESSION)
FIND_LIBRARY (ZSTD_LIBRARY NAMES zstd)
FIND_PATH (ZSTD_INCLUDE_DIRS zstd.h)
INCLUDE_DIRECTORIES (${ZSTD_INCLUDE_DIRS})
ENDIF (ENABLE_ZSTD_COMPRESSION)
IF (RPM5)
MESSAGE (STATUS "Enabling RPM 5 support")
ADD_DEFINITIONS (-DRPM5)
SET (ENABLE_RPMDB ON)
SET (ENABLE_RPMMD ON)
FIND_PACKAGE (PkgConfig REQUIRED)
PKG_CHECK_MODULES (RPM REQUIRED rpm)
INCLUDE_DIRECTORIES (${RPM_INCLUDE_DIRS})
ENDIF (RPM5)
IF (ENABLE_CONDA)
SET (MULTI_SEMANTICS ON)
ENDIF (ENABLE_CONDA)
IF (MULTI_SEMANTICS)
MESSAGE (STATUS "Enabling multi dist support")
ENDIF (MULTI_SEMANTICS)
IF (ENABLE_RPMDB)
SET (ENABLE_RPMPKG ON)
ENDIF (ENABLE_RPMDB)
INCLUDE (CheckIncludeFile)
IF (ENABLE_RPMDB OR ENABLE_RPMPKG_LIBRPM)
FIND_PATH (RPM_INCLUDE_DIR NAMES rpm/rpmio.h)
IF (RPM_INCLUDE_DIR)
INCLUDE_DIRECTORIES (${RPM_INCLUDE_DIR})
SET (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${RPM_INCLUDE_DIR})
ENDIF (RPM_INCLUDE_DIR)
FIND_LIBRARY (RPMDB_LIBRARY NAMES rpmdb)
IF (NOT RPMDB_LIBRARY)
FIND_LIBRARY (RPMDB_LIBRARY NAMES rpm)
ENDIF (NOT RPMDB_LIBRARY)
FIND_LIBRARY (RPMIO_LIBRARY NAMES rpmio)
IF (RPMIO_LIBRARY)
SET(RPMDB_LIBRARY ${RPMIO_LIBRARY} ${RPMDB_LIBRARY})
ENDIF (RPMIO_LIBRARY)
IF (RPM5)
FIND_LIBRARY (RPMMISC_LIBRARY NAMES rpmmisc)
IF (RPMMISC_LIBRARY)
SET (RPMDB_LIBRARY ${RPMMISC_LIBRARY} ${RPMDB_LIBRARY})
ENDIF (RPMMISC_LIBRARY)
ENDIF (RPM5)
IF (ENABLE_RPMDB)
IF (NOT ENABLE_RPMDB_BDB)
SET (ENABLE_RPMDB_LIBRPM ON)
ENDIF (NOT ENABLE_RPMDB_BDB)
# check if rpm contains a bundled berkeley db
CHECK_INCLUDE_FILE(rpm/db.h HAVE_RPM_DB_H)
IF (NOT ENABLE_RPMDB_LIBRPM)
IF (NOT HAVE_RPM_DB_H)
FIND_LIBRARY (DB_LIBRARY NAMES db)
IF (DB_LIBRARY)
SET (RPMDB_LIBRARY ${DB_LIBRARY} ${RPMDB_LIBRARY})
ENDIF (DB_LIBRARY)
IF (DB_INCLUDE_DIR)
INCLUDE_DIRECTORIES (${DB_INCLUDE_DIR})
ENDIF (DB_INCLUDE_DIR)
ENDIF (NOT HAVE_RPM_DB_H)
ENDIF (NOT ENABLE_RPMDB_LIBRPM)
ENDIF (ENABLE_RPMDB)
INCLUDE (CheckLibraryExists)
CHECK_LIBRARY_EXISTS(rpm rpmdbNextIteratorHeaderBlob "" HAVE_RPMDBNEXTITERATORHEADERBLOB)
CHECK_LIBRARY_EXISTS(rpm rpmdbFStat "" HAVE_RPMDBFSTAT)
ENDIF (ENABLE_RPMDB OR ENABLE_RPMPKG_LIBRPM)
IF (ENABLE_PUBKEY)
SET (ENABLE_PGPVRFY ON)
ENDIF (ENABLE_PUBKEY)
INCLUDE (CheckFunctionExists)
INCLUDE (TestBigEndian)
CHECK_FUNCTION_EXISTS (strchrnul HAVE_STRCHRNUL)
CHECK_FUNCTION_EXISTS (fopencookie HAVE_FOPENCOOKIE)
CHECK_FUNCTION_EXISTS (funopen HAVE_FUNOPEN)
TEST_BIG_ENDIAN (WORDS_BIGENDIAN)
IF (${CMAKE_MAJOR_VERSION} GREATER 2)
INCLUDE (CMakePushCheckState)
INCLUDE (CheckCCompilerFlag)
MACRO (check_linker_flag FLAG VAR)
CMAKE_PUSH_CHECK_STATE (RESET)
SET (CMAKE_REQUIRED_FLAGS "${FLAG}")
CHECK_C_COMPILER_FLAG ("" "${VAR}")
CMAKE_POP_CHECK_STATE ()
ENDMACRO (check_linker_flag)
check_linker_flag("-Wl,--as-needed" HAVE_LINKER_AS_NEEDED)
check_linker_flag("-Wl,--version-script=${CMAKE_SOURCE_DIR}/src/libsolv.ver" HAVE_LINKER_VERSION_SCRIPT)
ELSE (${CMAKE_MAJOR_VERSION} GREATER 2)
SET (HAVE_LINKER_AS_NEEDED 1)
SET (HAVE_LINKER_VERSION_SCRIPT 1)
ENDIF (${CMAKE_MAJOR_VERSION} GREATER 2)
# should create config.h with #cmakedefine instead...
FOREACH (VAR HAVE_STRCHRNUL HAVE_FOPENCOOKIE HAVE_FUNOPEN WORDS_BIGENDIAN
HAVE_RPM_DB_H HAVE_RPMDBNEXTITERATORHEADERBLOB HAVE_RPMDBFSTAT
WITH_LIBXML2 WITHOUT_COOKIEOPEN)
IF(${VAR})
ADD_DEFINITIONS (-D${VAR}=1)
SET (SWIG_FLAGS ${SWIG_FLAGS} -D${VAR})
ENDIF (${VAR})
ENDFOREACH (VAR)
FOREACH (VAR
ENABLE_LINKED_PKGS ENABLE_COMPLEX_DEPS MULTI_SEMANTICS ENABLE_CONDA)
IF(${VAR})
ADD_DEFINITIONS (-D${VAR}=1)
SET (SWIG_FLAGS ${SWIG_FLAGS} -D${VAR})
STRING(REPLACE ENABLE_ "" VARX ${VAR})
SET (LIBSOLV_FEATURE_${VARX} 1)
ENDIF (${VAR})
ENDFOREACH (VAR)
FOREACH (VAR
ENABLE_RPMDB ENABLE_RPMPKG ENABLE_PUBKEY ENABLE_RPMMD
ENABLE_RPMPKG_LIBRPM ENABLE_RPMDB_LIBRPM ENABLE_RPMDB_BYRPMHEADER
ENABLE_SUSEREPO ENABLE_COMPS ENABLE_TESTCASE_HELIXREPO
ENABLE_HELIXREPO ENABLE_MDKREPO ENABLE_ARCHREPO ENABLE_DEBIAN ENABLE_HAIKU
ENABLE_ZLIB_COMPRESSION ENABLE_LZMA_COMPRESSION ENABLE_BZIP2_COMPRESSION
ENABLE_ZSTD_COMPRESSION ENABLE_ZCHUNK_COMPRESSION ENABLE_PGPVRFY ENABLE_APPDATA
WITH_SYSTEM_ZCHUNK)
IF(${VAR})
ADD_DEFINITIONS (-D${VAR}=1)
SET (SWIG_FLAGS ${SWIG_FLAGS} -D${VAR})
STRING(REPLACE ENABLE_ "" VARX ${VAR})
SET (LIBSOLVEXT_FEATURE_${VARX} 1)
ENDIF (${VAR})
ENDFOREACH (VAR)
SET (PACKAGE "libsolv")
SET (VERSION "${LIBSOLV_MAJOR}.${LIBSOLV_MINOR}.${LIBSOLV_PATCH}")
ADD_DEFINITIONS (-D_FILE_OFFSET_BITS=64)
CONFIGURE_FILE (src/solvversion.h.in src/solvversion.h)
SET (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Package dependency solver library")
SET (CPACK_PACKAGE_VENDOR "SUSE")
SET (CPACK_PACKAGE_VERSION_MAJOR ${LIBSOLV_MAJOR})
SET (CPACK_PACKAGE_VERSION_MINOR ${LIBSOLV_MINOR})
SET (CPACK_PACKAGE_VERSION_PATCH ${LIBSOLV_PATCH})
SET (CPACK_GENERATOR "TBZ2")
SET (CPACK_SOURCE_GENERATOR "TBZ2")
SET (CPACK_SOURCE_PACKAGE_FILE_NAME "${PACKAGE}-${VERSION}")
SET (CPACK_SOURCE_TOPLEVEL_TAG "Linux-Source:")
SET (CPACK_TOPLEVEL_TAG "Linux-Source:")
# The following components are regex's to match anywhere (unless anchored)
# in absolute path + filename to find files or directories to be excluded
# from source tarball.
SET (CPACK_SOURCE_IGNORE_FILES
# temporary files
"\\\\.swp$"
# backup files
"~$"
# eclipse files
"\\\\.cdtproject$"
"\\\\.cproject$"
"\\\\.project$"
"\\\\.settings/"
# others
"\\\\.#"
"/#"
"/build/"
"/_build/"
"/\\\\.git/"
# used before
"/\\\\.libs/"
"/\\\\.deps/"
"\\\\.o$"
"\\\\.lo$"
"\\\\.la$"
"Makefile$"
"Makefile\\\\.in$"
# cmake cache files
"DartConfiguration.tcl$"
"CMakeCache.txt"
"CMakeFiles"
"cmake_install.cmake$"
"CMakeLists.txt.auto$"
"CTestTestfile.cmake"
"CPackConfig.cmake$"
"CPackSourceConfig.cmake$"
"libsolv.spec$"
)
INCLUDE(CPack)
####################################################################
# INCLUDES #
####################################################################
#SET (CMAKE_INCLUDE_DIRECTORIES_BEFORE ON)
INCLUDE_DIRECTORIES (${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/ext ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR}/src SYSTEM )
####################################################################
MESSAGE (STATUS "Looking for modules in ${CMAKE_MODULE_PATH}")
IF (MSVC)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4267")
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
ELSE ()
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3")
set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -O3")
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0")
ENDIF ()
# set system libraries
SET (SYSTEM_LIBRARIES "")
IF (ENABLE_RPMMD OR ENABLE_SUSEREPO OR ENABLE_APPDATA OR ENABLE_COMPS OR ENABLE_HELIXREPO OR ENABLE_MDKREPO)
IF (WITH_LIBXML2 )
SET (SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${LIBXML2_LIBRARIES})
ELSE (WITH_LIBXML2 )
SET (SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${EXPAT_LIBRARY})
ENDIF (WITH_LIBXML2 )
ENDIF (ENABLE_RPMMD OR ENABLE_SUSEREPO OR ENABLE_APPDATA OR ENABLE_COMPS OR ENABLE_HELIXREPO OR ENABLE_MDKREPO)
IF (ENABLE_ZLIB_COMPRESSION)
SET (SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${ZLIB_LIBRARY})
ENDIF (ENABLE_ZLIB_COMPRESSION)
IF (ENABLE_LZMA_COMPRESSION)
SET (SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${LZMA_LIBRARY})
ENDIF (ENABLE_LZMA_COMPRESSION)
IF (ENABLE_BZIP2_COMPRESSION)
SET (SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${BZIP2_LIBRARIES})
ENDIF (ENABLE_BZIP2_COMPRESSION)
IF (ENABLE_ZSTD_COMPRESSION)
SET (SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${ZSTD_LIBRARY})
ENDIF (ENABLE_ZSTD_COMPRESSION)
IF (WITH_SYSTEM_ZCHUNK)
SET (SYSTEM_LIBRARIES ${SYSTEM_LIBRARIES} ${ZCHUNK_LIBRARIES})
ENDIF (WITH_SYSTEM_ZCHUNK)
IF (ENABLE_RPMDB)
SET (SYSTEM_LIBRARIES ${RPMDB_LIBRARY} ${SYSTEM_LIBRARIES})
ENDIF (ENABLE_RPMDB)
IF (ENABLE_HAIKU)
SET (SYSTEM_LIBRARIES ${HAIKU_SYSTEM_LIBRARIES} ${SYSTEM_LIBRARIES})
ENDIF (ENABLE_HAIKU)
IF (HAVE_LINKER_AS_NEEDED)
SET (SYSTEM_LIBRARIES "-Wl,--as-needed" ${SYSTEM_LIBRARIES})
ENDIF (HAVE_LINKER_AS_NEEDED)
ADD_SUBDIRECTORY (src)
ADD_SUBDIRECTORY (ext)
ADD_SUBDIRECTORY (tools)
IF (ENABLE_PERL OR ENABLE_PYTHON OR ENABLE_PYTHON3 OR ENABLE_RUBY OR ENABLE_TCL)
ADD_SUBDIRECTORY (bindings)
ENDIF (ENABLE_PERL OR ENABLE_PYTHON OR ENABLE_PYTHON3 OR ENABLE_RUBY OR ENABLE_TCL)
ADD_SUBDIRECTORY (examples)
ADD_SUBDIRECTORY (doc)
MESSAGE (STATUS "Version: ${VERSION}")
####################################################################
# RPM SPEC #
####################################################################
MACRO (SPECFILE)
MESSAGE (STATUS "Writing spec file...")
CONFIGURE_FILE (${CMAKE_SOURCE_DIR}/package/libsolv.spec.in ${CMAKE_BINARY_DIR}/package/libsolv.spec @ONLY)
ENDMACRO (SPECFILE)
MACRO (PCFILE)
MESSAGE (STATUS "Writing pkg-config files...")
CONFIGURE_FILE (${CMAKE_SOURCE_DIR}/libsolv.pc.in ${CMAKE_BINARY_DIR}/libsolv.pc @ONLY)
INSTALL( FILES ${CMAKE_BINARY_DIR}/libsolv.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
CONFIGURE_FILE (${CMAKE_SOURCE_DIR}/libsolvext.pc.in ${CMAKE_BINARY_DIR}/libsolvext.pc @ONLY)
INSTALL( FILES ${CMAKE_BINARY_DIR}/libsolvext.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
ENDMACRO (PCFILE)
SPECFILE ()
PCFILE ()
SET (AUTOBUILD_COMMAND
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/package/*.tar.bz2
COMMAND mkdir -p _CPack_Packages/${CPACK_TOPLEVEL_TAG}
COMMAND ${CMAKE_MAKE_PROGRAM} package_source
COMMAND ${CMAKE_COMMAND} -E copy ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2 ${CMAKE_BINARY_DIR}/package
COMMAND ${CMAKE_COMMAND} -E remove ${CPACK_SOURCE_PACKAGE_FILE_NAME}.tar.bz2
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/package/libsolv.changes" "${CMAKE_BINARY_DIR}/package/libsolv.changes"
)
ADD_CUSTOM_TARGET (srcpackage
${AUTOBUILD_COMMAND}
)
ADD_CUSTOM_TARGET (srcpackage_local
${AUTOBUILD_COMMAND}
)
ENABLE_TESTING()
ADD_SUBDIRECTORY (test)