-
Notifications
You must be signed in to change notification settings - Fork 10
/
CMakeLists.txt
118 lines (102 loc) · 3.88 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#
# telekom / sysrepo-plugin-system
#
# This program is made available under the terms of the
# BSD 3-Clause license which is available at
# https://opensource.org/licenses/BSD-3-Clause
#
# SPDX-FileCopyrightText: 2021 Deutsche Telekom AG
# SPDX-FileContributor: Sartura Ltd.
#
# SPDX-License-Identifier: BSD-3-Clause
#
cmake_minimum_required(VERSION 3.0)
project(sysrepo-plugin-system C)
include(CompileOptions.cmake)
set(PLUGIN_CORE_LIBRARY_NAME "srplg-ietf-system-core")
option(ENABLE_BUILD_TESTS, "Build tests" OFF)
option(ENABLE_AUGEAS_PLUGIN, "Build augeas specific plugin" OFF)
# local includes
include_directories(
${CMAKE_SOURCE_DIR}/src/
${CMAKE_SOURCE_DIR}/deps/uthash/include
)
# find needed and optional packages
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMakeModules")
find_package(SYSREPO REQUIRED)
find_package(LIBYANG REQUIRED)
find_package(SRPC REQUIRED)
find_package(UMGMT REQUIRED)
find_package(LIBSYSTEMD REQUIRED)
find_package(AUGYANG)
# package includes
include_directories(
${SYSREPO_INCLUDE_DIRS}
${LIBYANG_INCLUDE_DIRS}
${SRPC_INCLUDE_DIRS}
${UMGMT_INCLUDE_DIRS}
${SYSTEMD_INCLUDE_DIRS}
)
# sources
set(
CORE_SOURCES
${CMAKE_SOURCE_DIR}/src/core/common.c
${CMAKE_SOURCE_DIR}/src/core/ly_tree.c
# startup
${CMAKE_SOURCE_DIR}/src/core/startup/load.c
${CMAKE_SOURCE_DIR}/src/core/startup/store.c
# subs
${CMAKE_SOURCE_DIR}/src/core/subscription/change.c
${CMAKE_SOURCE_DIR}/src/core/subscription/operational.c
${CMAKE_SOURCE_DIR}/src/core/subscription/rpc.c
# data
${CMAKE_SOURCE_DIR}/src/core/data/system/ip_address.c
${CMAKE_SOURCE_DIR}/src/core/data/system/dns_resolver/search.c
${CMAKE_SOURCE_DIR}/src/core/data/system/dns_resolver/search/list.c
${CMAKE_SOURCE_DIR}/src/core/data/system/dns_resolver/server.c
${CMAKE_SOURCE_DIR}/src/core/data/system/dns_resolver/server/list.c
${CMAKE_SOURCE_DIR}/src/core/data/system/ntp/server.c
${CMAKE_SOURCE_DIR}/src/core/data/system/ntp/server/list.c
${CMAKE_SOURCE_DIR}/src/core/data/system/authentication/authorized_key.c
${CMAKE_SOURCE_DIR}/src/core/data/system/authentication/authorized_key/list.c
${CMAKE_SOURCE_DIR}/src/core/data/system/authentication/local_user.c
${CMAKE_SOURCE_DIR}/src/core/data/system/authentication/local_user/list.c
# system API
${CMAKE_SOURCE_DIR}/src/core/api/system/load.c
${CMAKE_SOURCE_DIR}/src/core/api/system/check.c
${CMAKE_SOURCE_DIR}/src/core/api/system/store.c
${CMAKE_SOURCE_DIR}/src/core/api/system/change.c
${CMAKE_SOURCE_DIR}/src/core/api/system/ntp/load.c
${CMAKE_SOURCE_DIR}/src/core/api/system/ntp/check.c
${CMAKE_SOURCE_DIR}/src/core/api/system/ntp/store.c
${CMAKE_SOURCE_DIR}/src/core/api/system/ntp/change.c
${CMAKE_SOURCE_DIR}/src/core/api/system/dns_resolver/load.c
${CMAKE_SOURCE_DIR}/src/core/api/system/dns_resolver/check.c
${CMAKE_SOURCE_DIR}/src/core/api/system/dns_resolver/store.c
${CMAKE_SOURCE_DIR}/src/core/api/system/dns_resolver/change.c
${CMAKE_SOURCE_DIR}/src/core/api/system/authentication/load.c
${CMAKE_SOURCE_DIR}/src/core/api/system/authentication/check.c
${CMAKE_SOURCE_DIR}/src/core/api/system/authentication/store.c
${CMAKE_SOURCE_DIR}/src/core/api/system/authentication/change.c
)
# build plugin core static library
add_library(${PLUGIN_CORE_LIBRARY_NAME} STATIC ${CORE_SOURCES})
target_compile_options(
${PLUGIN_CORE_LIBRARY_NAME}
PRIVATE
-fPIC
)
# add main plugin to the build process
add_subdirectory("src/plugins/ietf-system")
# augyang support
if(AUGYANG_FOUND AND ENABLE_AUGEAS_PLUGIN)
add_subdirectory("src/plugins/ietf-system-augeas")
else(AUGYANG_FOUND)
message(WARNING "AUGYANG not found - disabled build of the augeas specific plugin")
endif()
# unit testing
if(ENABLE_BUILD_TESTS)
find_package(CMOCKA REQUIRED)
include(CTest)
include(tests/unit/Tests.cmake)
endif()