-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
63 lines (52 loc) · 1.79 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
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
cmake_minimum_required(VERSION 3.13)
project(dockerized-restinio
VERSION 0.1
)
set(SOURCE "src")
set(INCLUDE "include")
set(TEST "test")
add_executable(
dockerized-restinio
${SOURCE}/controller/readyness-controller.cpp
${SOURCE}/dockerized-restinio.cpp
${SOURCE}/options.cpp
${INCLUDE}/controller/controller-interface.h
${INCLUDE}/controller/readyness-controller.h
${INCLUDE}/dispatcher.h
${INCLUDE}/options.h
)
find_package(Threads)
find_package(fmt REQUIRED)
find_package(unofficial-http-parser REQUIRED)
find_package(Boost REQUIRED COMPONENTS system filesystem program_options unit_test_framework)
find_package(restinio REQUIRED)
include_directories (${INCLUDE} ${Boost_INCLUDE_DIRS})
set(
LINK_TARGETS
${CMAKE_THREAD_LIBS_INIT}
fmt::fmt
unofficial::http_parser::http_parser
${Boost_LIBRARIES}
restinio::restinio
)
enable_testing()
file(GLOB TEST_SRCS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${TEST}/*.cpp)
foreach(testSrc ${TEST_SRCS})
get_filename_component(testName ${testSrc} NAME_WE)
add_executable(${testName} ${testSrc} ${SOURCE}/options.cpp)
target_link_libraries(${testName} ${LINK_TARGETS} )
set_target_properties(${testName} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/testBin)
set_property(TARGET ${testName} PROPERTY CXX_STANDARD 14)
add_test(
NAME ${testName}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/testBin
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/testBin/${testName}
)
endforeach(testSrc)
target_link_libraries(dockerized-restinio PRIVATE ${LINK_TARGETS})
set_property(TARGET dockerized-restinio PROPERTY CXX_STANDARD 14)