QMake: how to delete folder on clean on windows
-
Issue:
I'm using windows and qmake for my project. For some of my resources, I copy some files and folders over to the output directory as a post-build step (as opposed to using the qt resource system). Then upon clean I want to also clean my resources, so I can be sure that I've refreshed my files when I'm doing a rebuild.For deleting files I can do something like
QMAKE_CLEAN += $$PWD/Resources/*.dat
But I cannot delete folders using
QMAKE_CLEAN
, it looks like it expects files only (I found this piece of documentation on harvard.edu)
I also found theQMAKE_DEL_TREE
command, but I cannot seem to combine it withQMAKE_CLEAN
.QMAKE_DEL_TREE
turns intormdir /s /q
on windows, but when I add it toQMAKE_CLEAN
, my forward slashes turn into backslashes (maybe becauseQMAKE_CLEAN
expects files, I'm on windows, and it thinks it's being smart?). Obviously, this breaks the command.Is there a way to delete the folder incl all contents? I'm deleting stuff on a file-by-file basis now, but this does not scale well for deeper directory trees.