Boost test linking

后端 未结 4 610
花落未央
花落未央 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条回答
  •  Happy的楠姐
    2020-12-23 23:14

    You need to compile with -lboost_unit_test_framework, boost generates the main for you if you use the BOOST_TEST_DYN_LINK so you need to tell the makefile to look for that main. Then you can compile using the following:

    #define BOOST_TEST_DYN_LINK
    #define BOOST_TEST_MODULE LogManager                                   
    BOOST_AUTO_TEST_CASE(LogManagerCase)                                   
    {                                                                      
        BOOST_REQUIRE(true);                                               
        /*LogManager manager;                                              
        manager.Initialize();                                              
        manager.Deinitialize();*/                                          
    }                                                                      
    BOOST_AUTO_TEST_SUITE_END()    
    

提交回复
热议问题