user2317537
user2317537

Reputation: 89

Any way to automate a folder delete before building?

Basically, I want to delete the folder named:

build-[Project Name]-Desktop_Qt_5_0_2_MSVC2010_32bit-Debug

before compiling.

Upvotes: 3

Views: 1140

Answers (2)

Ilya Kobelevskiy
Ilya Kobelevskiy

Reputation: 5345

Take a look at system command for qmake, which allows executing any shell command of the operating system: http://harmattan-dev.nokia.com/docs/library/html/qt4/qmake-function-reference.html#system-command

In windows you can put

system(rmdir /Q /S "build-[Project Name]-Desktop_Qt_5_0_2_MSVC2010_32bit-Debug")

in your .pro file. If you need other platforms, you can check which platform it is and call appropriate shell command for that platform using same syntax.

Upvotes: 2

Sergey Shambir
Sergey Shambir

Reputation: 1602

Go to project settings (Ctrl+5, a.k.a. 5th mode), and add new build step with custom command 'rmdir', and arguments '/s /q path-to-target-directory'.

Don't forget that custom build step should be on top of list, before 'qmake' step.

Upvotes: 3

Related Questions