diff options
author | mingchuan <mingc@skymizer.com> | 2018-07-26 22:23:53 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-08-02 20:08:24 +0800 |
commit | b89365282bb047756f1cc52587a60766a7fe2f02 (patch) | |
tree | 7c520a0ba147451cdf2ab5fd57c97f754b9d01dd /test/boostTest.cpp | |
parent | 6003ed2abdea76e809b1e6501b9e5a85b38e5859 (diff) | |
download | dexon-solidity-b89365282bb047756f1cc52587a60766a7fe2f02.tar.gz dexon-solidity-b89365282bb047756f1cc52587a60766a7fe2f02.tar.zst dexon-solidity-b89365282bb047756f1cc52587a60766a7fe2f02.zip |
Fix shared boost test library build by customizing main
Diffstat (limited to 'test/boostTest.cpp')
-rw-r--r-- | test/boostTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/boostTest.cpp b/test/boostTest.cpp index 6c68100c..f23355fd 100644 --- a/test/boostTest.cpp +++ b/test/boostTest.cpp @@ -153,3 +153,18 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) return 0; } + +// BOOST_TEST_DYN_LINK should be defined if user want to link against shared boost test library +#ifdef BOOST_TEST_DYN_LINK + +// Because we want to have customized initialization function and support shared boost libraries at the same time, +// we are forced to customize the entry point. +// see: https://www.boost.org/doc/libs/1_67_0/libs/test/doc/html/boost_test/adv_scenarios/shared_lib_customizations/init_func.html + +int main(int argc, char* argv[]) +{ + auto init_unit_test = []() -> bool { init_unit_test_suite(0, nullptr); return true; }; + return boost::unit_test::unit_test_main(init_unit_test, argc, argv); +} + +#endif |