-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
75 lines (57 loc) · 2.47 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
cmake_minimum_required(VERSION 3.9)
project(Valravn)
set(CMAKE_CXX_STANDARD 17)
set(SOURCE_FILES main.cpp
headers/core/StringTools.h)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
find_package(Boost COMPONENTS system REQUIRED)
find_package(Boost COMPONENTS )
find_package(Boost COMPONENTS filesystem system REQUIRED)
find_package(SQLite3 REQUIRED)
find_package(LIBVLC REQUIRED)
find_package(oatpp 1.3.0 REQUIRED)
find_package(oatpp-swagger 1.3.0 REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
add_executable(${CMAKE_PROJECT_NAME}_run ${SOURCE_FILES})
include_directories(headers)
add_subdirectory(src)
add_subdirectory(tests)
# Doxygen Build
option(BUILD_DOC "Build Documentation" ON)
find_package(Doxygen)
if(DOXYGEN_FOUND)
set(BUILD_DOC_DIR ${CMAKE_SOURCE_DIR}/build/docs)
if(NOT EXISTS ${BUILD_DOC_DIR})
file(MAKE_DIRECTORY ${BUILD_DOC_DIR})
endif()
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
message("Doxygen buld started")
add_custom_target(Doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM)
else(DOXYGEN_FOUND)
message("Doxygen needs to be installed to generate the documentation.")
endif(DOXYGEN_FOUND)
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"
)
target_link_libraries (${CMAKE_PROJECT_NAME}_run oatpp::oatpp oatpp::oatpp-swagger)
target_link_libraries(${CMAKE_PROJECT_NAME}_run ${CMAKE_PROJECT_NAME}_lib)
target_link_libraries (${CMAKE_PROJECT_NAME}_run ${Boost_SYSTEM_LIBRARY})
target_link_libraries (${CMAKE_PROJECT_NAME}_run ${Boost_FILESYSTEM_LIBRARY})
target_link_libraries (${CMAKE_PROJECT_NAME}_run ${LIBVLC_LIBRARY})
target_link_libraries (${CMAKE_PROJECT_NAME}_run ${SQLITE3_LIBRARY})