How to run multiple commands with an extra target in QMake

The value of .commands variable is pasted in the place of target commands in Makefile by qmake as is. qmake strips any whitespaces from values and changes them into single spaces so it's impossible to create multiline value without a special tool. And there is the tool: function escape_expand. Try this:

something.commands = mkdir newFolder $$escape_expand(\n\t) copy /Y someFolder\\file.dll newFolder

$$escape_expand(\n\t) adds new line character (ends previous command) and starts next command with a tab character as Makefile syntax dictates.


The and operator also works for me on Linux, and strangely windows.

something.commands = mkdir newFolder && copy /Y someFolder\\file.dll newFolder

Tags:

Qt

Qmake