如何在Qt-Creator中添加自定义构建步骤?

问题描述:

构建我的应用程序后,我想将其复制到特定目录(在Windows 7上)。

After build my app, i want copy it to specific directory (on Windows 7).

自定义构建步骤

cmd.exe \c \k copy MyPlugin.dll ..\..\..\HostApp\Debug\plugins

但是我有错误:

Can't run process "cmd.exe \c \k copy MyPlugin.dll ..\..\..\HostApp\Debug\plugins"

那是错的吗?

一个这样做的方法是更改​​.pro文件中的生成输出目录。
之类的

One way to do it would be to change the build output directory in the .pro file. Something like

CONFIG(debug, debug|release) {
    DESTDIR = C:/myApp/debug
} else {
    DESTDIR = C:/myApp/release
}

或者在您的特定情况下

CONFIG(debug, debug|release) {
    DESTDIR = ..\..\..\HostApp\Debug\plugins
} else {
    DESTDIR = ..\..\..\HostApp\Release\plugins
}

编辑:
问题有一些很好的替代方法。

This question has some good alternatives to my answer.