简体   繁体   English

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

[英]QMAKE, CPPUTEST - Configuring a qmake project with cpputest

for a given qmake project: 对于给定的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

how can I configure the project file to include the test driver, and test file so that only when the debug flag is raised it will include the test source files? 如何配置项目文件以包括测试驱动程序和测试文件,以便仅在发出调试标志时才包括测试源文件?

Wrap them into debug : 将它们包装到debug

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

Solution: 解:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM