23c6cce5a3
FossilOrigin-Name: d6717095c67fcfb2fcd120f16d392929ef8872c210fb55d2b393ae99c3d21177
45 lines
1,016 B
CMake
45 lines
1,016 B
CMake
cmake_minimum_required(VERSION 3.10)
|
|
project(wormhole)
|
|
|
|
# General includes
|
|
include(CTest)
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
find_package(Threads REQUIRED)
|
|
pkg_check_modules(LIBMICROHTTPD REQUIRED libmicrohttpd)
|
|
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
# C++ settings
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
|
|
|
|
include_directories(wormhole
|
|
${LIBMICROHTTPD_INCLUDE_DIRS}
|
|
${YAML_CPP_INCLUDE_DIRS}
|
|
src/
|
|
)
|
|
|
|
# files
|
|
set(sources src/main.cpp
|
|
src/database/database.cpp
|
|
src/database/sqlite/sqlite.cpp
|
|
src/http/httpserver.cpp
|
|
src/http/microhttpd_server.cpp
|
|
src/http/request.cpp
|
|
src/http/response.cpp
|
|
src/config/config_loader.cpp
|
|
src/logger.cpp)
|
|
|
|
# automated tests
|
|
if(BUILD_TESTING)
|
|
add_subdirectory(test)
|
|
endif()
|
|
|
|
# files
|
|
add_executable(wormhole ${sources})
|
|
target_link_libraries(wormhole ${CMAKE_DL_LIBS}
|
|
${LIBMICROHTTPD_LIBRARIES}
|
|
${YAML_CPP_LIBRARIES}
|
|
${CMAKE_THREAD_LIBS_INIT})
|