我有一个库,我想把它复制到一个目录,这取决于我在什么配置(调试或发布)。这是我的项目文件。
#-------------------------------------------------
#
# Project created by QtCreator 2011-08-13T12:48:33
#
#-------------------------------------------------
TARGET = JECLibrary
TEMPLATE = lib
DEFINES += JECLIBRARY_LIBRARY
SOURCES +=
JECMessageText.cpp
JECMessageCombo.cpp
JECButton.cpp
HEADERS +=
JECLibrary_global.h
JECMessageText.h
JECMessageCombo.h
JECButton.h
CONFIG(debug, debug|release)
{
DLLDESTDIR += $$quote(../../../Jane/Jane/Build/debug)
message("Copying to Jane Debug Directory.")
}
CONFIG(release, debug|release)
{
DLLDESTDIR += $$quote(../../../Jane/Jane/Build/release)
message("Copying to Jane Release Directory.")
}
FORMS +=
JECMessageText.ui
JECMessageCombo.ui
由于某些原因,调试或发布DLL被复制到两个目录中,而不是只有一个。因此,如果我在发布模式下运行,我将在Debug目录和发布目录中获得发布DLL。
我完全糊涂了。有人能解释一下吗?由于
左大括号应与条件在同一行:
CONFIG(debug, debug|release) {
DLLDESTDIR += $$quote(../../../Jane/Jane/Build/debug)
message("Copying to Jane Debug Directory.")
}
CONFIG(release, debug|release) {
DLLDESTDIR += $$quote(../../../Jane/Jane/Build/release)
message("Copying to Jane Release Directory.")
}
或
CONFIG(debug, debug|release) {
DLLDESTDIR += $$quote(../../../Jane/Jane/Build/debug)
message("Copying to Jane Debug Directory.")
} else {
DLLDESTDIR += $$quote(../../../Jane/Jane/Build/release)
message("Copying to Jane Release Directory.")
}
但是这两个消息都将被显示,因为文件Makefile。调试和生成文件。Release都是在运行qmake
时创建的(在Windows上,或者如果在其他操作系统上将debug_and_release添加到CONFIG变量中)。