File: CMakeLists.txt

package info (click to toggle)
librepo 1.12.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 3,976 kB
  • sloc: ansic: 17,443; python: 3,721; xml: 581; sh: 113; makefile: 64
file content (96 lines) | stat: -rw-r--r-- 2,596 bytes parent folder | download
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
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)

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)
PKG_SEARCH_MODULE(LIBCRYPTO REQUIRED libcrypto openssl)
PKG_CHECK_MODULES(LIBXML2 libxml-2.0 REQUIRED)
FIND_PACKAGE(CURL 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 (NOT PYTHON_DESIRED)
    FIND_PACKAGE (PythonInterp REQUIRED)
ELSEIF (${PYTHON_DESIRED} STREQUAL "2")
    FIND_PACKAGE (PythonInterp 2 EXACT REQUIRED)
ELSEIF (${PYTHON_DESIRED} STREQUAL "3")
    FIND_PACKAGE (PythonInterp 3 EXACT REQUIRED)
ELSEIF (EXISTS ${PYTHON_DESIRED})
    SET (PYTHON_EXECUTABLE ${PYTHON_DESIRED})
    FIND_PACKAGE (PythonInterp REQUIRED)
ELSE ()
    MESSAGE (FATAL_ERROR "Invalid PYTHON_DESIRED value: " ${PYTHON_DESIRED})
ENDIF()
FIND_PACKAGE (PythonLibs REQUIRED)


# Subdirs

ADD_SUBDIRECTORY (librepo)

IF (ENABLE_TESTS)
  PKG_CHECK_MODULES(CHECK check REQUIRED)
  ENABLE_TESTING()
  ADD_SUBDIRECTORY (tests)
ENDIF (ENABLE_TESTS)

IF (ENABLE_DOCS)
  ADD_SUBDIRECTORY (doc)
ENDIF (ENABLE_DOCS)