-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
134 lines (110 loc) · 3.6 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
cmake_minimum_required (VERSION 3.8)
project(requester VERSION 1.0 LANGUAGES C)
# MSVC hot reload.
if (POLICY CMP0141)
cmake_policy(SET CMP0141 NEW)
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>")
endif()
find_package(OpenSSL REQUIRED)
list(APPEND CORE_SOURCE_FILES
"src/core/core.h"
"src/core/http_default.h"
"src/core/config.h"
"src/core/utils/utils.h"
"src/core/utils/arrays.h"
"src/core/utils/data_types_aliases.h"
"src/core/utils/float_string.c"
"src/core/utils/float_string.h"
"src/core/utils/int_string.c"
"src/core/utils/int_string.h"
"src/core/utils/print_log.c"
"src/core/utils/print_log.h"
"src/core/utils/pointers.h"
"src/core/utils/strings.h"
"src/core/utils/strings.c"
"src/core/utils/math.h"
"src/core/network/network.h"
"src/core/network/client_socket.c"
"src/core/network/client_socket.h"
"src/core/network/secure_client_layer.c"
"src/core/network/secure_client_layer.h"
"src/core/structs/structs.h"
"src/core/structs/http_content.c"
"src/core/structs/http_content.h"
"src/core/structs/http_headers.c"
"src/core/structs/http_headers.h"
"src/core/structs/http_method.c"
"src/core/structs/http_method.h"
"src/core/structs/http_method_text.h"
"src/core/structs/http_request.c"
"src/core/structs/http_request.h"
"src/core/structs/http_response.c"
"src/core/structs/http_response.h"
"src/core/structs/http_status.c"
"src/core/structs/http_status.h"
"src/core/structs/http_status_text.h"
"src/core/structs/http_version.c"
"src/core/structs/http_version.h"
"src/core/structs/http_version_text.h"
"src/core/structs/mime_type.c"
"src/core/structs/mime_type.h"
"src/core/structs/mime_type_text.h"
"src/core/structs/query_params.c"
"src/core/structs/query_params.h"
"src/core/structs/string_map.c"
"src/core/structs/string_map.h"
"src/core/structs/url.c"
"src/core/structs/url.h"
"src/core/structs/url_protocol.c"
"src/core/structs/url_protocol.h"
"src/core/structs/url_protocol_text.h"
)
if (WIN32)
list(APPEND CORE_SOURCE_FILES
"src/core/network/client_socket_windows.c"
)
else()
list(APPEND CORE_SOURCE_FILES
"src/core/network/client_socket_unix.c"
)
endif()
list(APPEND CLIENT_SOURCE_FILES
"src/client/client.h"
"src/client/config.h"
"src/client/http_client.h"
"src/client/http_client.c"
"src/client/http_client_abstractions.c"
"src/client/http_client_abstractions.h"
)
list(APPEND HELPERS_SOURCE_FILES
"src/helpers/helpers.h"
"src/helpers/user_agents.h"
)
list(APPEND SOURCE_FILES
"src/requester.h"
${CORE_SOURCE_FILES}
${CLIENT_SOURCE_FILES}
${HELPERS_SOURCE_FILES}
)
# Add the library as a dynamic library, to avoid this, define the
# REQUESTER_BUILD_STATIC variable.
if (NOT DEFINED REQUESTER_BUILD_STATIC)
add_library (requester ${SOURCE_FILES})
else()
add_library (requester STATIC ${SOURCE_FILES})
endif()
target_include_directories(requester PUBLIC "src" "src/core")
target_link_libraries(requester PRIVATE OpenSSL::SSL)
if (WIN32)
target_link_libraries(requester PRIVATE ws2_32)
endif()
if (CMAKE_VERSION VERSION_GREATER 3.12)
set_property(TARGET requester PROPERTY C_STANDARD 90)
endif()
# Build examples.
#
# To avoid building examples by default, define the REQUESTER_DONT_BUILD_EXAMPLES
# variable.
if(NOT DEFINED REQUESTER_DONT_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()