Skip to content

Commit c31e693

Browse files
committed
Merge pull request cpp-netlib#270 from tjadevries/0.9-devel
Support Boost dynamic linking tests.
2 parents a5feaa6 + dd2d96c commit c31e693

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

CMakeLists.txt

+11-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@
55

66
cmake_minimum_required(VERSION 2.8)
77
project(CPP-NETLIB)
8-
set(Boost_USE_STATIC_LIBS ON)
8+
9+
option (BOOST_DYN_LINK
10+
"Build the project using dynamic linking for the boost testing libs"
11+
OFF)
12+
if (BOOST_DYN_LINK)
13+
message ("Linking boost testing libs dynamically...")
14+
add_definitions(-DBOOST_TEST_DYN_LINK)
15+
elseif (BOOST_DYN_LINK)
16+
set(Boost_USE_STATIC_LIBS ON)
17+
endif(BOOST_DYN_LINK)
18+
919
set(Boost_USE_MULTI_THREADED ON)
1020
find_package( Boost 1.45.0 REQUIRED unit_test_framework system regex date_time thread filesystem program_options chrono )
1121
find_package( OpenSSL )

libs/mime/test/CMakeLists.txt

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
include_directories(${CPP-NETLIB_SOURCE_DIR})
22
find_package ( Boost 1.41.0 COMPONENTS unit_test_framework )
3-
set ( Boost_USE_STATIC_LIBS ON )
3+
4+
option (BOOST_DYN_LINK
5+
"Build the project using dynamic linking for the boost test libs"
6+
OFF)
7+
if (BOOST_DYN_LINK)
8+
message ("Do not try to link boost test libs dynamically for this test...")
9+
remove_definitions(-DBOOST_TEST_DYN_LINK)
10+
elseif (BOOST_DYN_LINK)
11+
set(Boost_USE_STATIC_LIBS ON)
12+
endif(BOOST_DYN_LINK)
13+
414
set ( Boost_USE_MULTITHREADED ON )
515

616
if ( Boost_FOUND )

libs/network/test/http/server_async_run_stop_concurrency.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#define BOOST_TEST_MODULE HTTP Asynchronous Server Tests
2+
#ifdef BOOST_TEST_DYN_LINK
3+
#define BOOST_TEST_NO_MAIN
4+
#endif /* BOOST_TEST_DYN_LINK */
25

36
#include <boost/network/include/http/server.hpp>
47
#include <boost/test/unit_test.hpp>
@@ -135,3 +138,6 @@ int main(int argc, char * argv[]) {
135138

136139
return 0;
137140
}
141+
#ifdef BOOST_TEST_DYN_LINK
142+
#undef BOOST_TEST_NO_MAIN
143+
#endif /* BOOST_TEST_DYN_LINK */

0 commit comments

Comments
 (0)