forked from AndreLouisCaron/httpxx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
73 lines (59 loc) · 1.83 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
#
# C++ wrappers for C-based HTTP parser library.
#
cmake_minimum_required(VERSION 2.6)
project(httpxx)
# Compile API documentation from source code.
function(add_api_documentation target)
if(DOXYGEN_EXECUTABLE)
add_custom_target(
${target}
COMMAND
${DOXYGEN_EXECUTABLE}
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}
COMMENT
"Compiling documentation."
VERBATIM
)
endif()
endfunction()
enable_testing()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs)
# http_parser does not provide a CMake build script.
set(http_parser_DIR
${CMAKE_SOURCE_DIR}/libs/http_parser
)
set(http_parser_headers ${http_parser_DIR}/http_parser.h)
set(http_parser_sources ${http_parser_DIR}/http_parser.c)
if(MSVC)
# MSVC does not support C99, but its C++ compiler is
# compatible with the http_parser library's code.
set_source_files_properties(
${http_parser_headers}
${http_parser_sources}
PROPERTIES LANGUAGE CXX
)
endif()
add_library(http_parser
${http_parser_sources}
)
target_include_directories(
http_parser PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/libs/http_parser)
install(FILES ${http_parser_headers} DESTINATION include/http_parser)
install(TARGETS http_parser LIBRARY DESTINATION lib ARCHIVE DESTINATION lib)
# Build the primary target.
add_subdirectory(code)
option(BUILD_EXAMPLES "Build examples and documentation" ON)
# When building in standalone mode, build demo projects.
if(BUILD_EXAMPLES AND ${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME})
# Build API documentation.
find_package(Doxygen QUIET)
configure_file(
${CMAKE_SOURCE_DIR}/help/Doxyfile
${CMAKE_BINARY_DIR}/Doxyfile @ONLY)
add_api_documentation(doc)
# Resolve include directives as if installed on the system.
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/code)
add_subdirectory(test)
endif()