-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
144 lines (116 loc) · 4.17 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
cmake_minimum_required(VERSION 3.20)
project(crud)
set(CMAKE_CXX_STANDARD 17)
add_library(crud-lib
src/controller/StaticController.hpp
src/controller/SkillController.hpp
src/controller/EducationController.hpp
src/controller/ExperienceController.hpp
src/controller/Personal_infoController.hpp
src/db/SkillDb.hpp
src/db/EducationDb.hpp
src/db/ExperienceDb.hpp
src/db/Personal_infoDb.hpp
src/dto/PageDto.hpp
src/dto/StatusDto.hpp
src/dto/SkillDto.hpp
src/dto/EducationDto.hpp
src/dto/ExperienceDto.hpp
src/dto/Personal_infoDto.hpp
src/service/SkillService.cpp
src/service/SkillService.hpp
src/service/EducationService.cpp
src/service/EducationService.hpp
src/service/ExperienceService.cpp
src/service/ExperienceService.hpp
src/service/Personal_infoService.cpp
src/service/Personal_infoService.hpp
src/AppComponent.hpp
src/DatabaseComponent.hpp
src/SwaggerComponent.hpp
src/ErrorHandler.cpp
src/ErrorHandler.hpp)
## include directories
target_include_directories(crud-lib PUBLIC src)
## link libs
find_package(oatpp 1.4.0 REQUIRED)
find_package(oatpp-swagger 1.4.0 REQUIRED)
find_package(oatpp-sqlite 1.4.0 REQUIRED)
target_link_libraries(crud-lib
# Oat++
PUBLIC oatpp::oatpp
PUBLIC oatpp::oatpp-swagger
PUBLIC oatpp::oatpp-sqlite
)
# If CMake can't find SQLite3:
#
# 1. Make sure that you've built oatpp-sqlite with -DOATPP_SQLITE_AMALGAMATION=ON flag
# 2. If you are not willing to use SQLite amalgamation then uncomment the following lines:
#
#find_package(SQLite3 REQUIRED)
#
#target_link_libraries(crud-lib
# PUBLIC SQLite::SQLite3
#)
add_definitions(
## define path to swagger-ui static resources folder
-DOATPP_SWAGGER_RES_PATH="${oatpp-swagger_INCLUDE_DIRS}/../bin/oatpp-swagger/res"
## SQLite database file
-DDATABASE_FILE="${CMAKE_CURRENT_SOURCE_DIR}/db.sqlite"
## SQLite database test file
-DTESTDATABASE_FILE="${CMAKE_CURRENT_SOURCE_DIR}/test-db.sqlite"
## Path to database migration scripts
-DDATABASE_MIGRATIONS="${CMAKE_CURRENT_SOURCE_DIR}/sql"
)
if(CMAKE_SYSTEM_NAME MATCHES Linux)
find_package(Threads REQUIRED)
target_link_libraries(crud-lib INTERFACE Threads::Threads ${CMAKE_DL_LIBS})
endif()
## add executables
add_executable(crud-exe src/App.cpp)
target_link_libraries(crud-exe crud-lib)
#add_executable(crud-test
# test/tests.cpp
# test/app/TestClient.hpp
# test/app/TestDatabaseComponent.hpp
# test/app/TestComponent.hpp
# test/UserControllerTest.hpp
# test/UserControllerTest.cpp)
#target_link_libraries(crud-test crud-lib)
#enable_testing()
#add_test(project-tests crud-test)
## CPack configuration
include(CPack)
set(CPACK_PACKAGE_NAME "crud")
set(CPACK_PACKAGE_VENDOR "Your Company")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A simple CRUD application")
set(CPACK_PACKAGE_VERSION "1.0.0")
set(CPACK_PACKAGE_VERSION_MAJOR "1")
set(CPACK_PACKAGE_VERSION_MINOR "0")
set(CPACK_PACKAGE_VERSION_PATCH "0")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
endif()
if(UNIX)
set(CPACK_GENERATOR "TGZ")
elseif(WIN32)
set(CPACK_GENERATOR "ZIP")
endif()
# Optional: Additional settings for RPM or DEB packages
#set(CPACK_RPM_PACKAGE_REQUIRES "oatpp")
#set(CPACK_DEBIAN_PACKAGE_DEPENDS "oatpp")
# Add additional package contents (e.g., config files, documentation)
install(TARGETS crud-exe DESTINATION bin)
install(DIRECTORY src/ DESTINATION include/crud FILES_MATCHING PATTERN "*.hpp")
# Finalize CPack
include(CPack)
# Set CPack variables
set(CPACK_PACKAGE_NAME "YourProjectName")
set(CPACK_PACKAGE_VERSION "1.0.0")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Your Project Description")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
include(CPack)