forked from rpm-software-management/createrepo_c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
91 lines (62 loc) · 2.12 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
PROJECT (createrepo_c)
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -Wall -Wextra")
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
IF(CMAKE_BUILD_TYPE AND CMAKE_BUILD_TYPE STREQUAL "DEBUG")
MESSAGE("Build type is set do DEBUG!")
ENDIF()
# Add path with own cmake modules
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Find necessare libraries
find_package(BZip2 REQUIRED)
find_package(CURL REQUIRED)
find_package(EXPAT REQUIRED)
find_package(GLIB2 REQUIRED)
find_package(GTHREAD2 REQUIRED)
find_package(Libmagic REQUIRED)
find_package(LibXml2 REQUIRED)
find_package(LZMA REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(Sqlite3 REQUIRED)
find_package(ZLIB REQUIRED)
# Add include dirs
include_directories(${GLIB2_INCLUDE_DIRS})
include_directories(${LIBXML2_INCLUDE_DIR})
# rpm:
FIND_LIBRARY (RPMDB_LIBRARY NAMES rpmdb)
IF (NOT RPMDB_LIBRARY)
FIND_LIBRARY (RPMDB_LIBRARY NAMES rpm)
IF (NOT RPMDB_LIBRARY)
MESSAGE(FATAL_ERROR "No Rpm library installed")
ENDIF (NOT RPMDB_LIBRARY)
ENDIF (NOT RPMDB_LIBRARY)
# rpmio:
FIND_LIBRARY (RPMIO_LIBRARY NAMES rpmio)
IF (RPMIO_LIBRARY)
SET(RPMDB_LIBRARY ${RPMIO_LIBRARY} ${RPMDB_LIBRARY})
ELSE (RPMIO_LIBRARY)
MESSAGE(FATAL_ERROR "No Rpmio library installed")
ENDIF (RPMIO_LIBRARY)
# Get package version
INCLUDE (${CMAKE_SOURCE_DIR}/VERSION.cmake)
SET (VERSION "${CR_MAJOR}.${CR_MINOR}.${CR_PATCH}")
message("Package version: ${VERSION}")
# Other files
INSTALL(FILES createrepo_c.bash
DESTINATION "/etc/bash_completion.d")
# Gen manpage
#message("Gen manpage")
#execute_process(COMMAND bash gen_manpage.sh src/cmd_parser.c ../doc/ WORKING_DIRECTORY utils/)
# Add custom target for tests
ADD_CUSTOM_TARGET(tests)
# Subdirs
ADD_SUBDIRECTORY (src)
ADD_SUBDIRECTORY (doc)
ENABLE_TESTING()
ADD_SUBDIRECTORY (tests EXCLUDE_FROM_ALL)