我添加了googletest项目来构建配置(.pro文件):
// generate permutation of {a[st], a[st+1], ..., a[ed]}
void P(char a[], int st, int ed) {
if (st > ed) { puts(a); return; } // nothing to generate
for (int i=st; i<=ed; ++i) {
swap(a[st], a[i]); // enumerate first element
P(a, st+1, ed);
swap(a[st], a[i]); // recover
}
}
其中两个cpp文件都包含主要功能: 一个用于代码,另一个用于测试:
EntryPoint.cpp
INCLUDEPATH += googletest-dir/googletest
INCLUDEPATH += googletest-dir/googlemock
INCLUDEPATH += googletest-dir/googletest/include
INCLUDEPATH += googletest-dir/googlemock/include
LIBS += -lgtest -Lgoogletest-dir/build/googlemock/gtest
LIBS += -lgmock -Lgoogletest-dir/build/googlemock
SOURCES +=\
...
src/EntryPoint.cpp \
test/unit/UnitTest1.cpp
UnitTest1.cpp
int main(int argc, char **argv) {
int returnValue = ERROR_CODE_OK;
...
pGui->init(argc, argv);
return returnValue;
}
如何告诉项目(如何配置qtcreator .pro文件)当我正在发布时(make Makefile.release release)我不需要在构建中使用2个主文件但只需要使用EntryPoint.cpp吗?我仍然需要第二个主要用于IDE中的测试目的。