-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
56 lines (46 loc) · 1.68 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
cmake_minimum_required(VERSION 3.16)
project(
filmslibrary
VERSION 1.0
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Установка Google Tests, если их нет
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/03597a01ee50ed33e9dfd640b249b4be3799d395.zip
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
# Директория создания исполняемого файла
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# Включение каталогов с заголовочными файлами Crow и PostgreSQL
include_directories("third-party/Crow/include")
include_directories("third-party/json_nlohmann")
include_directories(${PostgreSQL_INCLUDE_DIRS})
# Добавление директорий для коротких записей инклюдов
include_directories(src)
# Поиск Crow и PostgreSQL
find_package(Crow PATHS "${CMAKE_CURRENT_SOURCE_DIR}/third-party/Crow/cmake")
find_package(PostgreSQL REQUIRED)
add_executable(${PROJECT_NAME}
src/main.cc
src/server/endpoints/endpoints.cc
src/server/endpoints/endpoints.h
src/database/postgres-wrapper.cc
src/database/postgres-wrapper.h
src/database/redis-wrapper.cc
src/database/redis-wrapper.h
src/utils/utils.h
src/utils/logger.h
src/server/server.cc
src/server/server.h
src/tests/tests.cc
src/tests/tests.h
)
if(APPLE)
include(".local/macos.cmake")
endif()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -Werror)
target_link_libraries(${PROJECT_NAME} PRIVATE ${PostgreSQL_LIBRARIES} GTest::gtest_main -lhiredis)