Skip to content

Commit a9cc84a

Browse files
committed
adjusted build instructions of test for shared libs
The unit tests will compile and run now as well for cpp-netlib compiled as shared libraries.
1 parent 0ca215c commit a9cc84a

23 files changed

+69
-6
lines changed

CMakeLists.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ find_package( ICU )
1717
if(BUILD_SHARED_LIBS)
1818
set(Boost_USE_STATIC_LIBS OFF)
1919
# TODO/NOTE:
20-
# the unit tests and examples won't compile with the current setup and
21-
# shared libraries yet
22-
set(BUILD_TESTS OFF)
20+
# the examples won't compile with the current setup and shared libraries yet
2321
set(BUILD_EXAMPLES OFF)
2422
else()
2523
set(Boost_USE_STATIC_LIBS ON)

libs/network/src/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ endforeach(src_file)
6161
set(CPP-NETLIB_HTTP_MESSAGE_SRCS http/request.cpp http/response.cpp)
6262
add_library(cppnetlib-http-message ${CPP-NETLIB_HTTP_MESSAGE_SRCS})
6363
add_dependencies(cppnetlib-http-message
64-
${Boost_LIBRARIES}
64+
# ${Boost_LIBRARIES}
6565
cppnetlib-message)
6666
target_link_libraries(cppnetlib-http-message
6767
${Boost_LIBRARIES}
@@ -99,7 +99,7 @@ set(CPP-NETLIB_HTTP_SERVER_SRCS
9999
)
100100
add_library(cppnetlib-http-server ${CPP-NETLIB_HTTP_SERVER_SRCS})
101101
add_dependencies(cppnetlib-http-server
102-
${Boost_LIBRARIES}
102+
# ${Boost_LIBRARIES}
103103
cppnetlib-constants
104104
cppnetlib-uri
105105
cppnetlib-message
@@ -150,7 +150,7 @@ set(CPP-NETLIB_HTTP_CLIENT_SRCS
150150
http/client.cpp)
151151
add_library(cppnetlib-http-client ${CPP-NETLIB_HTTP_CLIENT_SRCS})
152152
add_dependencies(cppnetlib-http-client
153-
${Boost_LIBRARIES}
153+
# ${Boost_LIBRARIES}
154154
cppnetlib-constants
155155
cppnetlib-uri
156156
cppnetlib-message

libs/network/test/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55

66
include_directories(${CPP-NETLIB_SOURCE_DIR}/include)
77

8+
if(BUILD_SHARED_LIBS)
9+
add_definitions(-DBUILD_SHARED_LIBS)
10+
endif()
11+
812
add_subdirectory(uri)
913
add_subdirectory(http)
1014

libs/network/test/http/client_constructor_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// (See accompanying file LICENSE_1_0.txt or copy at
66
// http://www.boost.org/LICENSE_1_0.txt)
77

8+
#ifdef BUILD_SHARED_LIBS
9+
# define BOOST_TEST_DYN_LINK
10+
#endif
811
#define BOOST_TEST_MODULE HTTP 1.0 Client Constructor Test
912
#include <network/include/http/client.hpp>
1013
#include <boost/test/unit_test.hpp>

libs/network/test/http/client_get_different_port_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// (See accompanying file LICENSE_1_0.txt or copy at
66
// http://www.boost.org/LICENSE_1_0.txt)
77

8+
#ifdef BUILD_SHARED_LIBS
9+
# define BOOST_TEST_DYN_LINK
10+
#endif
811
#define BOOST_TEST_MODULE HTTP Client Get Different Port Test
912
#include <network/include/http/client.hpp>
1013
#include <boost/test/unit_test.hpp>

libs/network/test/http/client_get_streaming_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// (See accompanying file LICENSE_1_0.txt or copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

7+
#ifdef BUILD_SHARED_LIBS
8+
# define BOOST_TEST_DYN_LINK
9+
#endif
710
#define BOOST_TEST_MODULE HTTP 1.1 Get Streaming Test
811
#include <network/include/http/client.hpp>
912
#include <boost/test/unit_test.hpp>

libs/network/test/http/client_get_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// (See accompanying file LICENSE_1_0.txt or copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

7+
#ifdef BUILD_SHARED_LIBS
8+
# define BOOST_TEST_DYN_LINK
9+
#endif
710
#define BOOST_TEST_MODULE HTTP 1.0 Get Test
811
#include <network/include/http/client.hpp>
912
#include <boost/test/unit_test.hpp>

libs/network/test/http/client_get_timeout_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// (See accompanying file LICENSE_1_0.txt or copy at
66
// http://www.boost.org/LICENSE_1_0.txt)
77

8+
#ifdef BUILD_SHARED_LIBS
9+
# define BOOST_TEST_DYN_LINK
10+
#endif
811
#define BOOST_TEST_MODULE HTTP Client Get Timeout Test
912
#include <network/include/http/client.hpp>
1013
#include <boost/test/unit_test.hpp>

libs/network/test/http/request_base_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// (See accompanying file LICENSE_1_0.txt or copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

7+
#ifdef BUILD_SHARED_LIBS
8+
# define BOOST_TEST_DYN_LINK
9+
#endif
710
#define BOOST_TEST_MODULE HTTP Request Storage Base Test
811
#include <network/protocol/http/request/request_base.hpp>
912
#include <boost/test/unit_test.hpp>

libs/network/test/http/request_linearize_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// (See accompanying file LICENSE_1_0.txt or copy at
66
// http://www.boost.org/LICENSE_1_0.txt)
77

8+
#ifdef BUILD_SHARED_LIBS
9+
# define BOOST_TEST_DYN_LINK
10+
#endif
811
#define BOOST_TEST_MODULE HTTP Request Linearize Test
912
#include <network/protocol/http/request.hpp>
1013
#include <network/protocol/http/algorithms/linearize.hpp>

libs/network/test/http/request_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// (See accompanying file LICENSE_1_0.txt or copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

7+
#ifdef BUILD_SHARED_LIBS
8+
# define BOOST_TEST_DYN_LINK
9+
#endif
710
#define BOOST_TEST_MODULE HTTP Request Test
811
#include <network/protocol/http/request.hpp>
912
#include <network/protocol/http/message/wrappers.hpp>

libs/network/test/http/response_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// (See accompanying file LICENSE_1_0.txt or copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

7+
#ifdef BUILD_SHARED_LIBS
8+
# define BOOST_TEST_DYN_LINK
9+
#endif
710
#define BOOST_TEST_MODULE HTTP Client Response Test
811
#include <network/protocol/http/response.hpp>
912
#include <boost/test/unit_test.hpp>

libs/network/test/http/server_async_run_stop_concurrency.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#ifdef BUILD_SHARED_LIBS
2+
# define BOOST_TEST_DYN_LINK
3+
# define BOOST_TEST_NO_MAIN
4+
#endif
15
#define BOOST_TEST_MODULE HTTP Asynchronous Server Tests
26

37
#include <network/include/http/server.hpp>

libs/network/test/http/server_constructor_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// (See accompanying file LICENSE_1_0.txt or copy at
66
// http://www.boost.org/LICENSE_1_0.txt)
77

8+
#ifdef BUILD_SHARED_LIBS
9+
# define BOOST_TEST_DYN_LINK
10+
#endif
811
#define BOOST_TEST_MODULE HTTP Server Construtor Tests
912

1013
#include <network/include/http/server.hpp>

libs/network/test/message_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// (See accompanying file LICENSE_1_0.txt or copy at
66
// http://www.boost.org/LICENSE_1_0.txt)
77

8+
#ifdef BUILD_SHARED_LIBS
9+
# define BOOST_TEST_DYN_LINK
10+
#endif
811
#define BOOST_TEST_MODULE message test
912
#include <boost/config/warning_disable.hpp>
1013
#include <boost/test/unit_test.hpp>

libs/network/test/message_transform_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// (See accompanying file LICENSE_1_0.txt or copy at
66
// http://www.boost.org/LICENSE_1_0.txt)
77

8+
#ifdef BUILD_SHARED_LIBS
9+
# define BOOST_TEST_DYN_LINK
10+
#endif
811
#define BOOST_TEST_MODULE message test
912
#include <boost/config/warning_disable.hpp>
1013
#include <boost/test/unit_test.hpp>

libs/network/test/uri/relative_uri_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// (See accompanying file LICENSE_1_0.txt or copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

7+
#ifdef BUILD_SHARED_LIBS
8+
# define BOOST_TEST_DYN_LINK
9+
#endif
710
#define BOOST_TEST_MODULE Relative URL Test
811
#include <boost/config/warning_disable.hpp>
912
#include <boost/test/unit_test.hpp>

libs/network/test/uri/scheme_tests.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// (See accompanying file LICENSE_1_0.txt or copy at
44
// http://www.boost.org/LICENSE_1_0.txt)
55

6+
#ifdef BUILD_SHARED_LIBS
7+
# define BOOST_TEST_DYN_LINK
8+
#endif
69
#define BOOST_TEST_MODULE URI Scheme Test
710
#include <boost/config/warning_disable.hpp>
811
#include <boost/test/unit_test.hpp>

libs/network/test/uri/uri_builder_stream_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// (See accompanying file LICENSE_1_0.txt or copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

7+
#ifdef BUILD_SHARED_LIBS
8+
# define BOOST_TEST_DYN_LINK
9+
#endif
710
#define BOOST_TEST_MODULE URI builder stream test
811
#include <boost/config/warning_disable.hpp>
912
#include <boost/test/unit_test.hpp>

libs/network/test/uri/uri_builder_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// (See accompanying file LICENSE_1_0.txt or copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

7+
#ifdef BUILD_SHARED_LIBS
8+
# define BOOST_TEST_DYN_LINK
9+
#endif
710
#define BOOST_TEST_MODULE URI builder test
811
#include <boost/config/warning_disable.hpp>
912
#include <boost/test/unit_test.hpp>

libs/network/test/uri/uri_encoding_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// (See accompanying file LICENSE_1_0.txt or copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

7+
#ifdef BUILD_SHARED_LIBS
8+
# define BOOST_TEST_DYN_LINK
9+
#endif
710
#define BOOST_TEST_MODULE URI encoding test
811
#include <boost/config/warning_disable.hpp>
912
#include <boost/test/unit_test.hpp>

libs/network/test/uri/uri_test.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
// (See accompanying file LICENSE_1_0.txt of copy at
55
// http://www.boost.org/LICENSE_1_0.txt)
66

7+
#ifdef BUILD_SHARED_LIBS
8+
# define BOOST_TEST_DYN_LINK
9+
#endif
710
#define BOOST_TEST_MODULE URI Test
811
#include <boost/config/warning_disable.hpp>
912
#include <boost/test/unit_test.hpp>

libs/network/test/utils_thread_pool.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
// (See accompanying file LICENSE_1_0.txt or copy at
66
// http://www.boost.org/LICENSE_1_0.txt)
77

8+
#ifdef BUILD_SHARED_LIBS
9+
# define BOOST_TEST_DYN_LINK
10+
#endif
811
#define BOOST_TEST_MODULE utils thread pool test
912
#include <boost/config/warning_disable.hpp>
1013
#include <boost/test/unit_test.hpp>

0 commit comments

Comments
 (0)