qt条件编译debug和release版本--qmake之CONFIG(debug, debug|release)

时间:2022-11-20 09:26:30

1.更改pro文件:(参考:http://blog.csdn.net/derryzhang/article/details/6592229

CONFIG+=debug_and_release
CONFIG(debug, debug|release){
    TARGET = ui_debug
} else {
    TARGET = ui_release
}

make 或make debug -------生成debug版

make release          -------生成release版

make all                 -------两个版本都生成


2.另一种应用:(参考:http://blog.csdn.net/zqf_office/article/details/23928895

CONFIG(debug, debug|release) {
LIBS += -L../lib1 -lhellod
} else {
LIBS += -L../lib2 -lhello
}

CONFIG(debug, debug|release):LIBS += -L../lib1 -lhellod
CONFIG(release, debug|release):LIBS += -L../lib2 -lhello


3.屏蔽release版本中所有QDebug()提示信息,可以在pro文件中添加DEFINES+=QT_NO_DEBUG_OUTPUT