forked from rpm-software-management/librepo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
87 lines (60 loc) · 2.25 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
PROJECT (librepo C)
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.5)
OPTION (ENABLE_TESTS "Build test?" ON)
OPTION (ENABLE_DOCS "Build docs?" ON)
OPTION (WITH_ZCHUNK "Build with zchunk support" ON)
OPTION (ENABLE_PYTHON "Build Python bindings" ON)
INCLUDE (${CMAKE_SOURCE_DIR}/VERSION.cmake)
SET (VERSION "${LIBREPO_MAJOR}.${LIBREPO_MINOR}.${LIBREPO_PATCH}")
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Wall")
SET (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -ggdb -O0 -Wall -Wextra -DDEBUG")
IF(CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "DEBUG" OR CMAKE_BUILD_TYPE STREQUAL "debug"))
MESSAGE("Build type is set do DEBUG!")
ENDIF()
# Set librepo log domain
add_definitions( -DG_LOG_DOMAIN="librepo" )
# 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(PkgConfig)
PKG_CHECK_MODULES(GLIB2 glib-2.0>=2.28 gio-2.0 REQUIRED)
PKG_SEARCH_MODULE(LIBCRYPTO REQUIRED libcrypto openssl)
PKG_CHECK_MODULES(LIBXML2 libxml-2.0 REQUIRED)
FIND_PACKAGE(CURL 7.52.0 REQUIRED)
FIND_PACKAGE(Gpgme REQUIRED)
IF (WITH_ZCHUNK)
PKG_CHECK_MODULES(ZCHUNKLIB zck>=0.9.11 REQUIRED)
SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWITH_ZCHUNK")
SET (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DWITH_ZCHUNK")
ENDIF (WITH_ZCHUNK)
INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS})
# Enable large file support
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE)
# Check libraries
IF (NOT LIBXML2_FOUND)
MESSAGE(FATAL_ERROR "No libxml-2.0 library installed")
ENDIF (NOT LIBXML2_FOUND)
IF (NOT CURL_FOUND)
MESSAGE(FATAL_ERROR "No CURL library installed")
ENDIF (NOT CURL_FOUND)
# Add include dirs
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
#INCLUDE_DIRECTORIES(${CHECK_INCLUDE_DIR})
include (GNUInstallDirs)
# Python stuff
IF (ENABLE_PYTHON)
FIND_PACKAGE (PythonInterp 3 EXACT REQUIRED)
FIND_PACKAGE (PythonLibs REQUIRED)
ENDIF (ENABLE_PYTHON)
# Subdirs
ADD_SUBDIRECTORY (librepo)
IF (ENABLE_TESTS)
PKG_CHECK_MODULES(LIBCHECK REQUIRED check)
ENABLE_TESTING()
ADD_SUBDIRECTORY (tests)
ENDIF (ENABLE_TESTS)
IF (ENABLE_DOCS)
ADD_SUBDIRECTORY (doc)
ENDIF (ENABLE_DOCS)