我正在使用制作额外的目标qmake
,并且我试图同时做两件事:创建一个新文件夹,然后将dll复制到该文件夹中。两种操作分开工作都可以,但是两者不能一起工作。
something.target = this
# This works:
# something.commands = mkdir newFolder
# This works too (if newFolder exists)
# something.commands = copy /Y someFolder\\file.dll newFolder
# This doesn't work:
something.commands = mkdir newFolder; \
copy /Y someFolder\\file.dll newFolder
QMAKE_EXTRA_TARGETS += something
PRE_TARGETDEPS += this
我以为这是正确的语法(我在这里和这里找到了类似的示例),但是出现了以下错误:
> mkdir newFolder; copy /Y someFolder\\file.dll newFolder
> The syntax of the command is incorrect.
语法在不同平台上或其他平台上是否不同?我正在使用Qt 5.0.1的Windows 7。
.commands
变量的值按原样由qmake粘贴在Makefile中的目标命令位置。qmake从值中剥离所有空格并将其更改为单个空格,因此,如果没有特殊工具,就无法创建多行值。并且有工具:函数escape_expand。试试这个:
something.commands = mkdir newFolder $$escape_expand(\n\t) copy /Y someFolder\\file.dll newFolder
$$escape_expand(\n\t)
根据Makefile语法的要求,添加换行符(结束上一个命令)并以制表符开始下一个命令。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句