-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
73 lines (55 loc) · 2.6 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
cmake_minimum_required(VERSION 2.8.5)
project(drpm C)
set(DRPM_MAJOR_VERSION 0)
set(DRPM_MINOR_VERSION 5)
set(DRPM_PATCH_VERSION 2)
set(DRPM_VERSION ${DRPM_MAJOR_VERSION}.${DRPM_MINOR_VERSION}.${DRPM_PATCH_VERSION})
include(GNUInstallDirs)
option(ENABLE_TESTS "Build and run tests?" ON)
option(WITH_ZSTD "Build with zstd support" ON)
find_package(PkgConfig REQUIRED)
find_package(ZLIB REQUIRED)
find_package(BZip2 REQUIRED)
find_package(LibLZMA REQUIRED)
pkg_check_modules(RPM rpm REQUIRED)
pkg_check_modules(LIBCRYPTO libcrypto REQUIRED)
if(WITH_ZSTD)
pkg_check_modules(ZSTD REQUIRED libzstd)
endif()
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_C_COMPILER_ID MATCHES "Clang") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
include (CheckCCompilerFlag)
CHECK_C_COMPILER_FLAG(-fvisibility=hidden DRPM_HAVE_VISIBILITY)
if (DRPM_HAVE_VISIBILITY)
set(VISIBILITY_FLAG -fvisibility=hidden)
endif()
set(CMAKE_C_FLAGS "${VISIBILITY_FLAG} ${CMAKE_C_FLAGS}" )
endif ()
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
set(CPACK_PACKAGE_NAME ${CMAKE_PROJECT_NAME})
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A small library for fetching information from deltarpm packages")
set(CPACK_PACKAGE_CONTACT "Matej Chalk <mchalk@redhat.com>")
set(CPACK_PACKAGE_VERSION_MAJOR ${DRPM_MAJOR_VERSION})
set(CPACK_PACKAGE_VERSION_MINOR ${DRPM_MINOR_VERSION})
set(CPACK_PACKAGE_VERSION_PATCH ${DRPM_PATCH_VERSION})
set(CPACK_SOURCE_IGNORE_FILES "/tmp/" "/build/" "/pkg/" "/html/" "/latex/" "drpm.spec" "\\\\.git" ".*~" ".*\\\\.o")
set(CPACK_SOURCE_GENERATOR "TBZ2")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
include(CPack)
set(DRPM_SOURCES drpm.c drpm_apply.c drpm_block.c drpm_compstrm.c drpm_decompstrm.c drpm_deltarpm.c drpm_diff.c drpm_make.c drpm_options.c drpm_read.c drpm_rpm.c drpm_search.c drpm_utils.c drpm_write.c)
set(DRPM_LINK_LIBRARIES ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${LIBLZMA_LIBRARIES} ${RPM_LIBRARIES} ${LIBCRYPTO_LIBRARIES})
if(HAVE_LZLIB_DEVEL)
list(APPEND DRPM_LINK_LIBRARIES lz)
endif()
if(WITH_ZSTD)
list(APPEND DRPM_LINK_LIBRARIES ${ZSTD_LIBRARIES})
endif()
add_subdirectory(src)
add_subdirectory(doc)
if(ENABLE_TESTS)
pkg_check_modules(CMOCKA cmocka REQUIRED)
enable_testing()
add_subdirectory(test)
endif()
configure_file(drpm.pc.in ${CMAKE_CURRENT_BINARY_DIR}/drpm.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/drpm.pc DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig)