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:
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()
Try moving
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN
before your includes - it worked for me.
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
Once I made a stupid typo and also got this. And compiler was cheated.
Just as "#define BOOTS_TEST_MODULE DUMMY". Yes, I like boots :)