-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
70 lines (59 loc) · 1.95 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
cmake_minimum_required(VERSION 3.3)
project (httpserver)
SET(CMAKE_C_COMPILER "g++")
# The version number.
set (Tutorial_VERSION_MAJOR 1)
set (Tutorial_VERSION_MINOR 0)
# configure a header file to pass some of the CMake settings
# to the source code
#configure_file (
#"${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
#"${PROJECT_BINARY_DIR}/share/tcp_server.h"
#
#)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH})
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# package information
set(PACKAGE_NAME "httpserver")
set(PACKAGE_VERSION "0.0.1-dev")
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_TARNAME "${PACKAGE_NAME}-${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "https://github.com/Trree/httpserver/issues")
option(HTTPSERVER_ENABLE_TESTING "Enable testing of the library." ON)
set(TOP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
set(HTTP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/httpserver")
set(
HTTP_DIR_PREFIXES
"${CMAKE_CURRENT_SOURCE_DIR}:${CMAKE_CURRENT_BINARY_DIR}"
)
add_library(http_runtime SHARED
${HTTP_DIR}/http/response.cpp
)
target_sources(http_runtime PRIVATE
${HTTP_DIR}/handle_string.cpp
${HTTP_DIR}/inetaddress.cpp
${HTTP_DIR}/connection.cpp
${HTTP_DIR}/server.cpp
${HTTP_DIR}/main.cpp
)
target_include_directories(http_runtime
PUBLIC
${HTTP_INCLUDE_DIRECTORIES}
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
# add the binary tree to the search path for include files
# so that we will find TutorialConfig.h
ADD_DEFINITIONS(-std=c++11 -g3 -W -Wall -pedantic -D_GNU_SOURCE)
include(${CMAKE_MODULE_PATH}/clang-cxx-dev-tools.cmake)
#include(${CMAKE_MODULE_PATH}/common.cmake)
# add the executable
add_executable(${PROJECT_NAME}
${HTTP_DIR}/main.cpp
#$<TARGET_OBJECTS:http_runtime>
)
target_link_libraries(${PROJECT_NAME} http_runtime)
if (HTTPSERVER_ENABLE_TESTING)
enable_testing()
#add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
add_subdirectory(test)
endif()