I've added googletest project to build config(.pro file):
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
where both cpp files contains main functions: one for code and other for tests:
EntryPoint.cpp
int main(int argc, char **argv) {
int returnValue = ERROR_CODE_OK;
...
pGui->init(argc, argv);
return returnValue;
}
UnitTest1.cpp
int main(int argc, char** argv) {
::testing::InitGoogleMock(&argc, argv);
//::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
How to tell project(how to configure qtcreator .pro file) that when i'm making release(make Makefile.release release) i don't need to use 2 main files in build but only EntryPoint.cpp one? And I still need second main for testing purpose in IDE.