2015-02-09 61 views

回答

1

我这样做是通过创建这个Makefile.amtests目录,所有的测试代码为:

check_PROGRAMS = tests 

EXTRA_tests_SOURCES = test_example1.hpp 
EXTRA_tests_SOURCES += test_example2.hpp 

tests_SOURCES = runner-autogen.cpp 

BUILT_SOURCES = runner-autogen.cpp 
MAINTAINERCLEANFILES = runner-autogen.cpp 

runner-autogen.cpp: $(EXTRA_tests_SOURCES) 
    /path/to/cxxtest/bin/cxxtestgen --runner=ErrorPrinter -o [email protected] $< 

这样做是编译runner-autogen.cpp进入测试程序(称为tests),并与make check运行它。如果列出的任何.hpp文件发生更改,它将运行cxxtestgen重新创建runner-autogen.cpp

因为runner-autogen.cpp被列为源文件,它会被包括在make dist释放归档,因此除非他们改变.hpp文件之一的用户将不再需要cxxtest存在。