-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
92 lines (73 loc) · 2.09 KB
/
Copy pathCMakeLists.txt
File metadata and controls
92 lines (73 loc) · 2.09 KB
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
cmake_minimum_required(VERSION 3.16)
project(FirehornServer VERSION 1.0)
# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
# Find the required Qt6 components
find_package(Qt6 COMPONENTS Widgets Core Network SerialPort REQUIRED)
# Add CapsuleLib
add_library(CapsuleLib Capsule/src/capsule.h)
# Add FirehornCommons
# add_subdirectory(../commons FirehornCommons)
set(SOURCES_SERVER
src/server.cpp
src/RequestAdapter.cpp
src/network/RequestHandler.cpp
src/data_storage.cpp
)
set(HEADERS_SERVER
src/Setup.h
include/Server.h
include/RequestHandler.h
include/RequestAdapter.h
include/sqlite_orm.h
include/data_storage.h
)
# Create the library
add_library(${PROJECT_NAME}_lib STATIC ${SOURCES_SERVER} ${HEADERS_SERVER})
# Set include directories for the library
target_include_directories(${PROJECT_NAME}_lib
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include
)
# Link against the Qt6 modules and CapsuleLib for the library
target_link_libraries(${PROJECT_NAME}_lib
PUBLIC
Qt6::Widgets
Qt6::Core
Qt6::Network
Qt6::SerialPort
sqlite3
CapsuleLib
FirehornCommons
)
# Create the executable
add_executable(${PROJECT_NAME} src/main.cpp)
# Link the executable with the library
target_link_libraries(${PROJECT_NAME}
PRIVATE
${PROJECT_NAME}_lib
)
set_target_properties(${PROJECT_NAME} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}
)
##### data_storage stuff #####
find_package(SQLite3 REQUIRED)
SET(HEADERS_STORAGE
include/data_storage.h
include/sqlite_orm.h
)
SET(SOURCES_STORAGE
src/data_storage.cpp
)
add_library(data_storage_lib STATIC ${SOURCES_STORAGE} ${HEADERS_STORAGE})
add_executable(test tests/data_storage_tests.cpp)
target_link_libraries(test PRIVATE
data_storage_lib
SQLite::SQLite3
)
# google tests (comment manual testing (main function of data_storag_tests.cpp) in order to perform gtests)
enable_testing()
target_link_libraries(test PRIVATE gtest_main data_storage_lib)
add_test(NAME write_2_tests COMMAND test)