要添加到此(有點晚!),可以使用QMAKE_POST_LINK
在構建完成後複製文件。示例:
defineReplace(formatpath) {
path = $$1
win32 {
return(\"$$replace(path, "/", "\\")\")
} else:unix {
return($$replace(path, " ", "\\ "))
} else {
error("Unknown platform in formatpath!")
}
}
win32:COPY_CMD = copy
unix:COPY_CMD = cp -P
macx:COPY_CMD = cp -R
win32:CMD_SEP = $$escape_expand(\n\t)
unix:CMD_SEP = ";"
win32:LIB_EXT = dll
unix:LIB_EXT = so*
macx:LIB_EXT = dylib
# Put here the directory of your library's build dir, relative to the current directory
# A path is given for example...
MYLIB_BUILD_DIR = $$_PRO_FILE_PWD_/../lib/bin
QMAKE_POST_LINK += $$COPY_CMD $$formatpath($$MYLIB_BUILD_DIR/*.$$LIB_EXT) $$formatpath($$OUT_PWD/$$DESTDIR) $$CMD_SEP
此解決方案效果很好,謝謝。不過,我實際上只是把所有東西都放進垃圾箱。對不起,接受你的答案的延遲。 – 2010-05-22 07:22:19