-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
70 lines (54 loc) · 1.75 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
cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
cmake_policy (SET CMP0054 NEW)
set (CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
project (monitoring-service CXX)
# General options
option (ENABLE_UT "Enable unit tests" OFF)
option (ENABLE_UT_EXECUTION "Enable UT execution as part of build process" ON)
option (ENABLE_LOGS "Enable logging" ON)
# Compilation options
set (CMAKE_CXX_STANDARD 17)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Yocto integration
option(YOCTO_DEPENDENCIES "Use YOCTO dependencies system" ON)
# Build dependencies
include(cmake/dependencies.cmake)
# Compilation flags
include(cmake/flags.cmake)
# Build unit tests
if (${ENABLE_UT})
include(cmake/ut.cmake)
add_subdirectory(tests)
endif (${ENABLE_UT})
# Include directories
include_directories (src)
include_directories (src/utils)
# Source files
set (
SRC_FILES
src/main.cpp
src/core/persistent_storage.cpp
)
# Application
add_executable (monitoring-service ${SRC_FILES})
if (NOT ${YOCTO_DEPENDENCIES})
add_dependencies (monitoring-service sdbusplus-project)
add_dependencies (monitoring-service nlohmann-json-project)
endif ()
target_link_libraries (monitoring-service systemd)
target_link_libraries (monitoring-service stdc++fs)
target_link_libraries (monitoring-service sdbusplus)
#target_link_libraries (monitoring-service boost_date_time)
target_link_libraries (monitoring-service boost_coroutine)
target_compile_definitions (
monitoring-service
PRIVATE
$<$<BOOL:${ENABLE_LOGS}>: -DENABLE_LOGS>
)
install (
TARGETS monitoring-service
DESTINATION sbin)
install(
FILES ${PROJECT_SOURCE_DIR}/xyz.openbmc_project.MonitoringService.service
DESTINATION /lib/systemd/system/)