forked from rpm-software-management/librepo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
85 lines (57 loc) · 2.01 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
PROJECT (librepo LANGUAGES C)
CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
OPTION (ENABLE_TESTS "Build test?" ON)
OPTION (ENABLE_DOCS "Build docs?" 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 REQUIRED)
FIND_PACKAGE(EXPAT REQUIRED)
FIND_PACKAGE(CURL REQUIRED)
FIND_PACKAGE(Gpgme REQUIRED)
FIND_PACKAGE(Xattr REQUIRED)
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 EXPAT_FOUND)
MESSAGE(FATAL_ERROR "No Expat library installed")
ENDIF (NOT EXPAT_FOUND)
IF (NOT CURL_FOUND)
MESSAGE(FATAL_ERROR "No CURL library installed")
ENDIF (NOT CURL_FOUND)
# Add include dirs
INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIRS})
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
#INCLUDE_DIRECTORIES(${CHECK_INCLUDE_DIR})
IF (NOT LIB_INSTALL_DIR)
SET (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/usr/lib")
ENDIF (NOT LIB_INSTALL_DIR)
IF (NOT INCLUDE_INSTALL_DIR)
SET (INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/usr/include")
ENDIF (NOT INCLUDE_INSTALL_DIR)
# Python stuff
if (NOT PYTHON_DESIRED)
set (PYTHON_DESIRED "2")
endif()
# Subdirs
ADD_SUBDIRECTORY (librepo)
IF (ENABLE_TESTS)
FIND_LIBRARY(CHECK_LIBRARY NAMES check)
ENABLE_TESTING()
ADD_SUBDIRECTORY (tests)
ENDIF (ENABLE_TESTS)
IF (ENABLE_DOCS)
ADD_SUBDIRECTORY (doc)
ENDIF (ENABLE_DOCS)