QMAKE,CPPUTEST - 使用cpputest配置qmake项目

时间:2015-03-12 17:00:25

标签: qmake cpputest

给定的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

如何配置项目文件以包含测试驱动程序和测试文件,以便只有在引发调试标志时它才会包含测试源文件?

2 个答案:

答案 0 :(得分:1)

将它们包裹到debug

debug {
    SOURCES += testdriver.cpp
    SOURCES += tests.cpp
}

答案 1 :(得分:0)

解决方案:

######################################################################
# 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.cpp