首页 > 解决方案 > QMAKE / QT5:平台无关复制命令?

问题描述

QMAKE 中是否有独立于平台的方式来复制文件?目前我xcopy在windows下使用,它能够处理德语变音符号。

# Simple "Release" target related copy of compiled .exe file into .compiledOutput folder
# xcopy is windows dependant, but necessary to handle german umlauts

win32 {
    build_pass: CONFIG(release, debug|release) {
        QMAKE_POST_LINK += xcopy /Y $$quote($$system_path($$absolute_path($$OUT_PWD/release/$${TARGET}.exe))) \
        $$quote($$system_path($$absolute_path($$OUT_PWD/../$${TARGET}/.compiledOutput/)))
    }
    else: build_pass {
        # Do nothing, only copy release build to .compiledOutput
    }
}

我知道$$QMAKE_COPY不幸的是copy,我的 Qt5.8 设置解决了这个copy问题,并且有德语变音符号的问题。

标签: qtqt5qmake

解决方案


不确定,但您可以尝试:

  1. 将常见的 Windows cp.exe 替换为 xcopy.exe 。
  2. 将 cp.exe 软链接或硬链接到 xcopy.exe。并在 PATH 环境变量中的 cp.exe 文件夹之前包含文件夹。Qmake 必须使用您的 cp.exe 版本而不是系统版本。
  3. 在其他系统(而不是 Windows)上,您可以将 xcopy.exe 模拟为符号链接或可执行脚本。

推荐阅读