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 ) 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 ) 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 */