title: googletest: How can I include all of my tests in one executable?
body: <p>I am using the google test framework for C++.  Following the documentation and examples, I end up with a separate executable for every test ".cc" file that I create.  Is there a way to create a single executable that will call all of my unit tests?</p>
  
  <p>I would like to put my project in a CI tool that reports on test status, so I would like to have a single XML input file instead of many.</p>
  
  <p>The meat of my make file looks like this:</p>
  
  <pre><code>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)/$@
  </code></pre>