Boost test linking

后端 未结 4 609
花落未央
花落未央 2020-12-23 22:45

I want to use Boost test in my project.

I use cmake in my project so I wrote a simple CMakeList.txt for wrapping it:



        
4条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-23 23:16

    Add

    ADD_DEFINITIONS(-DBOOST_TEST_DYN_LINK) 
    

    to your CMakeLists.txt so it will automatically generate a main() for you. Also,

    #define BOOST_TEST_MODULE xxx
    

    must be defined before you include unit_test.hpp.

    You can find more information and options on: http://www.boost.org/doc/libs/1_47_0/libs/test/doc/html/utf/compilation.html

提交回复
热议问题