对于给定的qmake项目:
CONFIG += debug
CPPUTEST_HOME = /Users/vodde/workspace/cpputest
TEMPLATE = app
TARGET = design_patterns_qmake
DEPENDPATH += .
INCLUDEPATH += (CPPUTEST_HOME)/include
CONFIG += qt
CONFIG += x11
CONFIG += cpputest
QMAKE_CXXFLAGS_DEBUG += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorNewMacros.h
QMAKE_CXXFLAGS_DEBUG += -include $(CPPUTEST_HOME)/include/CppUTest/MemoryLeakDetectorMallocMacros.h
# Input
SOURCES += factorial.cpp
SOURCES += testdriver.cpp
SOURCES += tests.cpp如何将项目文件配置为包含测试驱动程序和测试文件,以便只有当调试标志被提升时,它才会包含测试源文件?
发布于 2015-03-12 17:13:27
将它们包装到debug中
debug {
SOURCES += testdriver.cpp
SOURCES += tests.cpp
}发布于 2015-03-12 19:05:55
解决方案:
######################################################################
# Automatically generated by qmake (2.01a) Thu Mar 12 14:32:44 2015
######################################################################
CPPUTEST_HOME = <cpputest path here>
CONFIG += qt debug
TEMPLATE = app
TARGET =a.out
DEPENDPATH += .
INCLUDEPATH += -I $$(CPPUTEST_HOME)/include
CONFIG += qt
CONFIG -= app_bundle
LIBS += -L $$(CPPUTEST_HOME)/lib -lCppUTest -lCppUTestExt
# Input
SOURCES += factorial.cpp
SOURCES +=factorial_test.cpphttps://stackoverflow.com/questions/29015895
复制相似问题