-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
98 lines (92 loc) · 2.7 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
##
## Copyright 2021 Centreon
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
## For more information : contact@centreon.com
##
# Global options.
set(INC_DIR "${PROJECT_SOURCE_DIR}/unified_sql/inc")
set(SRC_DIR "${PROJECT_SOURCE_DIR}/unified_sql/src")
set(TEST_DIR "${PROJECT_SOURCE_DIR}/unified_sql/test")
include_directories("${INC_DIR}" "${SRC_DIR}")
include_directories("${PROJECT_SOURCE_DIR}/neb/inc")
include_directories("${CMAKE_SOURCE_DIR}")
set(INC_DIR "${INC_DIR}/com/centreon/broker/unified_sql")
get_protobuf_files(rebuild_message)
get_protobuf_files(remove_graph_message)
# Storage module.
set(UNIFIED_SQL "20-unified_sql")
set(UNIFIED_SQL "${UNIFIED_SQL}" PARENT_SCOPE)
add_library("${UNIFIED_SQL}" SHARED
# Sources.
${SRC_DIR}/connector.cc
${SRC_DIR}/factory.cc
${SRC_DIR}/main.cc
${SRC_DIR}/rebuilder.cc
${SRC_DIR}/stored_timestamp.cc
${SRC_DIR}/stream.cc
${SRC_DIR}/stream_sql.cc
${SRC_DIR}/stream_storage.cc
${proto_rebuild_message}
${proto_remove_graph_message}
# Headers.
${INC_DIR}/connector.hh
${INC_DIR}/events.hh
${INC_DIR}/factory.hh
${INC_DIR}/internal.hh
${INC_DIR}/rebuilder.hh
${INC_DIR}/stored_timestamp.hh
${INC_DIR}/stream.hh
)
set_target_properties("${UNIFIED_SQL}" PROPERTIES
PREFIX ""
COMPILE_FLAGS "-fPIC")
add_dependencies("${UNIFIED_SQL}" target_rebuild_message target_remove_graph_message target_service target_host)
target_precompile_headers(${UNIFIED_SQL} PRIVATE precomp_inc/precomp.hpp)
target_link_libraries(${UNIFIED_SQL}
rokerbase
bbdo_storage
CONAN_PKG::spdlog
CONAN_PKG::abseil
pb_service_lib
pb_host_lib)
# Testing.
if (WITH_TESTING)
if (WITH_SQL_TESTS)
set(TEST_SOURCES ${TESTS_SOURCES} ${TEST_DIR}/conflict_manager.cc)
endif (WITH_SQL_TESTS)
# Testing.
set(
TESTS_SOURCES
${TESTS_SOURCES}
${TEST_DIR}/connector.cc
${TEST_DIR}/metric.cc
${TEST_DIR}/rebuild.cc
${TEST_DIR}/rebuild_message.cc
${TEST_DIR}/remove_graph.cc
${TEST_DIR}/status.cc
${TEST_DIR}/status-entry.cc
PARENT_SCOPE
)
set(
TESTS_LIBRARIES
${TESTS_LIBRARIES}
${UNIFIED_SQL}
PARENT_SCOPE
)
endif()
# Install rule.
install(TARGETS "${UNIFIED_SQL}"
LIBRARY DESTINATION "${PREFIX_MODULES}"
)