I am using Google test environment for C ++. Following the documentation and examples, I get a separate executable for each test ".cc" file that I create. Is there a way to create a single executable that will call all my unit tests?
I would like to put my project in a CI tool that reports the status of the test, so I would like to have one XML input file instead of many.
The meat of my make file looks like this:
class1_unittest.o : $(USER_TEST_DIR)/class1_unittest.cc $(USER_DIR)/class1.h $(GTEST_HEADERS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_TEST_DIR)/class1_unittest.cc
class1_unittest : class1.o day.o class1_unittest.o gtest_main.a
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -pthread $^ -o $(PROJECT_BIN)/$@
class2_unittest.o : $(USER_TEST_DIR)/class2_unittest.cc $(USER_DIR)/class2.h $(GTEST_HEADERS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(USER_TEST_DIR)/class2_unittest.cc
class2_unittest : class2.o day.o class2_unittest.o gtest_main.a
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -pthread $^ -o $(PROJECT_BIN)/$@
source
share