From f2c7a72fd29b1e8e621501061b57ebf5cd49a9e3 Mon Sep 17 00:00:00 2001 From: tjadevries Date: Fri, 5 Jul 2013 15:41:56 +0200 Subject: [PATCH 1/3] add --- CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d176a521..c194f988a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,7 +5,17 @@ cmake_minimum_required(VERSION 2.8) project(CPP-NETLIB) -set(Boost_USE_STATIC_LIBS ON) + +option (BOOST_DYN_LINK + "Build the project using dynamic linking for the boost testing libs" + OFF) +if (BOOST_DYN_LINK) + message ("Linking boost testing libs dynamically...") + add_definitions(-DBOOST_TEST_DYN_LINK) +elseif (BOOST_DYN_LINK) + set(Boost_USE_STATIC_LIBS ON) +endif(BOOST_DYN_LINK) + set(Boost_USE_MULTI_THREADED ON) find_package( Boost 1.45.0 REQUIRED unit_test_framework system regex date_time thread filesystem program_options chrono ) find_package( OpenSSL ) From 29d9beabd9d0ff489927dd6f750ac68879a36730 Mon Sep 17 00:00:00 2001 From: tjadevries Date: Fri, 5 Jul 2013 15:52:16 +0200 Subject: [PATCH 2/3] prevent multiple main()s in case of dynamic linking of boost testing --- .../network/test/http/server_async_run_stop_concurrency.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/network/test/http/server_async_run_stop_concurrency.cpp b/libs/network/test/http/server_async_run_stop_concurrency.cpp index 3fbf2b6db..c8c2371cc 100644 --- a/libs/network/test/http/server_async_run_stop_concurrency.cpp +++ b/libs/network/test/http/server_async_run_stop_concurrency.cpp @@ -1,4 +1,7 @@ #define BOOST_TEST_MODULE HTTP Asynchronous Server Tests +#ifdef BOOST_TEST_DYN_LINK +#define BOOST_TEST_NO_MAIN +#endif /* BOOST_TEST_DYN_LINK */ #include #include @@ -135,3 +138,6 @@ int main(int argc, char * argv[]) { return 0; } +#ifdef BOOST_TEST_DYN_LINK +#undef BOOST_TEST_NO_MAIN +#endif /* BOOST_TEST_DYN_LINK */ From dd2d96c2d5219523b09e3fba77e56bd197dcd8bc Mon Sep 17 00:00:00 2001 From: tjadevries Date: Fri, 5 Jul 2013 15:54:35 +0200 Subject: [PATCH 3/3] Do not try to link boost test libs dynamically for this test --- libs/mime/test/CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/mime/test/CMakeLists.txt b/libs/mime/test/CMakeLists.txt index 006a3f0b1..7860b99e9 100644 --- a/libs/mime/test/CMakeLists.txt +++ b/libs/mime/test/CMakeLists.txt @@ -1,6 +1,16 @@ include_directories(${CPP-NETLIB_SOURCE_DIR}) find_package ( Boost 1.41.0 COMPONENTS unit_test_framework ) -set ( Boost_USE_STATIC_LIBS ON ) + +option (BOOST_DYN_LINK + "Build the project using dynamic linking for the boost test libs" + OFF) +if (BOOST_DYN_LINK) + message ("Do not try to link boost test libs dynamically for this test...") + remove_definitions(-DBOOST_TEST_DYN_LINK) +elseif (BOOST_DYN_LINK) + set(Boost_USE_STATIC_LIBS ON) +endif(BOOST_DYN_LINK) + set ( Boost_USE_MULTITHREADED ON ) if ( Boost_FOUND )