@@ -8,11 +8,12 @@ include_directories(
8
8
${CPP-NETLIB_SOURCE_DIR}/message/src
9
9
${CPP-NETLIB_SOURCE_DIR}/logging/src
10
10
${CPP-NETLIB_SOURCE_DIR}/http/src
11
+ ${GTEST_INCLUDE_DIRS}
11
12
${CPP-NETLIB_SOURCE_DIR} )
12
13
13
14
if (OPENSSL_FOUND )
14
15
include_directories ( ${OPENSSL_INCLUDE_DIR} )
15
- add_definitions (-DBOOST_NETWORK_ENABLE_HTTPS )
16
+ add_definitions (-DNETWORK_ENABLE_HTTPS )
16
17
endif ()
17
18
18
19
if ( NOT CPP-NETLIB_DISABLE_LOGGING )
@@ -23,13 +24,13 @@ endif()
23
24
# if not then it will be empty
24
25
set ( CPP-NETLIB_LOGGING_LIB cppnetlib-logging )
25
26
26
- if (Boost_FOUND )
27
+ if (CPP-NETLIB_BUILD_TESTS )
27
28
# These are the internal (simple) tests.
28
- set ( MESSAGE_TESTS
29
+ set (MESSAGE_TESTS
29
30
request_base_test
30
31
request_test
31
- request_linearize_test
32
32
response_test
33
+ response_incremental_parser_test
33
34
)
34
35
foreach ( test ${MESSAGE_TESTS} )
35
36
if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU )
@@ -47,6 +48,7 @@ if (Boost_FOUND)
47
48
)
48
49
target_link_libraries (cpp-netlib-http-${test}
49
50
${Boost_LIBRARIES}
51
+ ${GTEST_BOTH_LIBRARIES}
50
52
${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
51
53
${CMAKE_THREAD_LIBS_INIT}
52
54
cppnetlib-message
@@ -62,69 +64,62 @@ if (Boost_FOUND)
62
64
${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test} )
63
65
endforeach (test )
64
66
65
- set ( TESTS
66
- client_constructor_test
67
- client_get_test
68
- client_get_different_port_test
69
- client_get_timeout_test
70
- client_get_streaming_test
71
- )
72
- foreach ( test ${TESTS} )
73
- if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU )
74
- set_source_files_properties (${test} .cpp
75
- PROPERTIES COMPILE_FLAGS "-Wall" )
76
- endif ()
77
- add_executable (cpp-netlib-http-${test} ${test} .cpp )
78
- target_link_libraries (cpp-netlib-http-${test}
79
- ${Boost_LIBRARIES}
80
- ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
81
- ${CMAKE_THREAD_LIBS_INIT}
82
- cppnetlib-constants
83
- cppnetlib-uri
84
- cppnetlib-message
85
- cppnetlib-message-wrappers
86
- cppnetlib-message-directives
87
- ${CPP-NETLIB_LOGGING_LIB}
88
- cppnetlib-http-message
89
- cppnetlib-http-message-wrappers
90
- cppnetlib-http-client
91
- cppnetlib-http-client-connections )
92
- if (OPENSSL_FOUND )
93
- target_link_libraries (cpp-netlib-http-${test} ${OPENSSL_LIBRARIES} )
94
- endif ()
95
- set_target_properties (cpp-netlib-http-${test}
96
- PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests )
97
- add_test (cpp-netlib-http-${test}
98
- ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test} )
99
- endforeach (test )
67
+ if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU )
68
+ set_source_files_properties (client_test.cpp
69
+ PROPERTIES COMPILE_FLAGS "-Wall" )
70
+ endif ()
71
+ add_executable (cpp-netlib-http-client_test client_test.cpp )
72
+ target_link_libraries (cpp-netlib-http-client_test
73
+ ${Boost_LIBRARIES}
74
+ ${GTEST_BOTH_LIBRARIES}
75
+ ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
76
+ ${CMAKE_THREAD_LIBS_INIT}
77
+ cppnetlib-constants
78
+ cppnetlib-uri
79
+ cppnetlib-message
80
+ cppnetlib-message-wrappers
81
+ cppnetlib-message-directives
82
+ ${CPP-NETLIB_LOGGING_LIB}
83
+ cppnetlib-http-message
84
+ cppnetlib-http-message-wrappers
85
+ cppnetlib-http-client
86
+ cppnetlib-http-client-connections )
87
+ if (OPENSSL_FOUND )
88
+ target_link_libraries (cpp-netlib-http-client_test ${OPENSSL_LIBRARIES} )
89
+ endif ()
90
+ set_target_properties (cpp-netlib-http-client_test
91
+ PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests )
92
+ add_test (cpp-netlib-http-client_test
93
+ ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test} )
100
94
101
- #set ( SERVER_API_TESTS
102
- # server_constructor_test
103
- # server_async_run_stop_concurrency
104
- # )
105
- #foreach ( test ${SERVER_API_TESTS} )
106
- # if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
107
- # set_source_files_properties(${test}.cpp
108
- # PROPERTIES COMPILE_FLAGS "-Wall")
109
- # endif()
110
- # add_executable(cpp-netlib-http-${test} ${test}.cpp)
111
- # target_link_libraries(cpp-netlib-http-${test}
112
- # ${Boost_LIBRARIES}
113
- # ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
114
- # ${CMAKE_THREAD_LIBS_INIT}
115
- # cppnetlib-constants
116
- # cppnetlib-uri
117
- # cppnetlib-message
118
- # cppnetlib-message-wrappers
119
- # cppnetlib-http-message
120
- # cppnetlib-http-server
121
- # cppnetlib-http-server-parsers
122
- # cppnetlib-utils-thread_pool
123
- # )
124
- # set_target_properties(cpp-netlib-http-${test}
125
- # PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
126
- # add_test(cpp-netlib-http-${test}
127
- # ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test})
128
- #endforeach (test)
95
+ # set ( SERVER_API_TESTS
96
+ # server_constructor_test
97
+ # server_async_run_stop_concurrency
98
+ # )
99
+ # foreach ( test ${SERVER_API_TESTS} )
100
+ # if (${CMAKE_CXX_COMPILER_ID} MATCHES GNU)
101
+ # set_source_files_properties(${test}.cpp
102
+ # PROPERTIES COMPILE_FLAGS "-Wall")
103
+ # endif()
104
+ # add_executable(cpp-netlib-http-${test} ${test}.cpp)
105
+ # target_link_libraries(cpp-netlib-http-${test}
106
+ # ${Boost_LIBRARIES}
107
+ # ${GTEST_BOTH_LIBRARIES}
108
+ # ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES}
109
+ # ${CMAKE_THREAD_LIBS_INIT}
110
+ # cppnetlib-constants
111
+ # cppnetlib-uri
112
+ # cppnetlib-message
113
+ # cppnetlib-message-wrappers
114
+ # cppnetlib-http-message
115
+ # cppnetlib-http-server
116
+ # cppnetlib-http-server-parsers
117
+ # cppnetlib-utils-thread_pool
118
+ # )
119
+ # set_target_properties(cpp-netlib-http-${test}
120
+ # PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CPP-NETLIB_BINARY_DIR}/tests)
121
+ # add_test(cpp-netlib-http-${test}
122
+ # ${CPP-NETLIB_BINARY_DIR}/tests/cpp-netlib-http-${test})
123
+ # endforeach (test)
129
124
130
125
endif ()
0 commit comments