forked from rpm-software-management/libdnf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
101 lines (80 loc) · 3.28 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
PROJECT (libdnf C CXX)
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.5)
CMAKE_POLICY (SET CMP0005 OLD)
# Avoid a warning because "hth" links to
# the in-tree libhawkey, but uses pkg-config to find
# GLib. There may be a better way to do this...
CMAKE_POLICY(SET CMP0003 NEW)
SET(CMAKE_MACOSX_RPATH 0)
include (VERSION.cmake)
message ("Building libdnf version: ${LIBDNF_VERSION}")
ADD_COMPILE_OPTIONS (-Wcast-align -Wno-uninitialized -Wredundant-decls -Wwrite-strings -Wformat-nonliteral -Wmissing-format-attribute -Wsign-compare -Wtype-limits -Wuninitialized -Wall -Werror=implicit-function-declaration -Wl,--as-needed)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu11 -Wmissing-prototypes -Waggregate-return -Wshadow")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wmissing-declarations")
include (CheckSymbolExists)
list (APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
check_symbol_exists (FNM_CASEFOLD "fnmatch.h" HAS_FNM_CASEFOLD)
if (NOT HAS_FNM_CASEFOLD)
message (SEND_ERROR "FNM_CASEFOLD is not available")
endif ()
ADD_DEFINITIONS(-DGETTEXT_DOMAIN=\\"libdnf\\")
ADD_DEFINITIONS(-DG_LOG_DOMAIN=\\"libdnf\\")
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR} libdnf/utils/)
OPTION(WITH_GTKDOC "Enables libdnf GTK-Doc HTML documentation" ON)
OPTION(WITH_MAN "Enables hawkey man page generation" ON)
OPTION (ENABLE_SOLV_URPMREORDER "Build with support for URPM-like solution reordering?" OFF)
option (ENABLE_RHSM_SUPPORT "Build with Red Hat Subscription Manager support?" OFF)
# hawkey dependencies
find_package (PkgConfig REQUIRED)
SET (CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
if (APPLE)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH};/usr/local/share/cmake/Modules/)
endif(APPLE)
PKG_CHECK_MODULES(GLIB gio-unix-2.0>=2.46.0 REQUIRED)
FIND_LIBRARY (RPMDB_LIBRARY NAMES rpmdb)
find_package (LibSolv 0.6.30 REQUIRED COMPONENTS ext)
if (ENABLE_RHSM_SUPPORT)
pkg_check_modules (RHSM REQUIRED librhsm)
include_directories (${RHSM_INCLUDE_DIRS})
add_definitions (-DRHSM_SUPPORT)
endif ()
pkg_check_modules (CHECK REQUIRED check)
pkg_check_modules (REPO REQUIRED librepo)
FIND_PROGRAM (VALGRIND_PROGRAM NAMES valgrind PATH /usr/bin /usr/local/bin)
IF (ENABLE_SOLV_URPMREORDER)
ADD_DEFINITIONS(-DLIBSOLV_FLAG_URPMREORDER=1)
ENDIF()
if (APPLE)
INCLUDE_DIRECTORIES(/usr/local/include)
endif(APPLE)
INCLUDE_DIRECTORIES(${REPO_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${GLIB_INCLUDE_DIRS})
link_directories(${REPO_LIBRARY_DIRS})
if (NOT PYTHON_DESIRED)
set (PYTHON_DESIRED "3")
endif()
# rpm:
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)
pkg_check_modules(SQLite3 sqlite3 REQUIRED)
ADD_DEFINITIONS(-DTESTDATADIR=\\"${CMAKE_SOURCE_DIR}/data/tests\\")
ADD_DEFINITIONS(-DPACKAGE_VERSION=\\"${LIBDNF_VERSION}\\")
include (GNUInstallDirs)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JSONC json-c)
include_directories(${JSONC_INCLUDE_DIRS})
ADD_SUBDIRECTORY (libdnf)
ADD_SUBDIRECTORY (po)
# ADD_SUBDIRECTORY (bindings/perl)
ADD_SUBDIRECTORY (bindings/python)
ENABLE_TESTING()
ADD_SUBDIRECTORY (tests)
ADD_SUBDIRECTORY (python/hawkey)
ADD_SUBDIRECTORY (docs/hawkey)
ADD_SUBDIRECTORY (docs/libdnf)