6

I am using a Qt .pro file using the SUBDIRS template (mainly following this answer).

Furthermore I am building my solution using qmake -recursive MyProject.pro and nmake Release.

Now I want to supply a separate batch file for cleaning up the release output and meta files (not the debug ones though).

The problem is that for the top-level Makefile, only clean and distclean is generated by qmake while for the subdirectories, there are also release-clean and debug-clean (also the folders contain an additional Makefile.Debug and Makefile.Release).

What I want to do is calling

nmake Makefile release-clean

from the batch script. However the top-level makefile does not contain this configuration.

Now I could call the equal line for every subproject manually but this is obviously my least favoured option.

Is there a way to either get qmake to generate a release-clean target for the top-level makefile or is there another way to simply clean release files?

PS: I'm using nmake, so yes I'm on Windows (XP) and using MSVC (2008)

Community
  • 1
  • 1
Tim Meyer
  • 12,210
  • 8
  • 64
  • 97

2 Answers2

2

The following batch script does the job :

REM set up environment
SET VISUALDIR=C:\PROGRA~1\MICROS~1.0
PUSHD %VISUALDIR%\VC
CALL vcvarsall.bat x86
POPD

REM clean solution
msbuild yoursolution.sln /p:Configuration=Release /t:clean

REM and you may want to add a build command :
msbuild yoursolution.sln /p:Configuration=Release
azf
  • 2,179
  • 16
  • 22
  • This is true if you have a VS Solution, however I'm just using `qmake` on the `.pro` file and then `nmake`. I could maybe add a `qmake -tp vc -recursive xxxx.pro` to generate the sln and then compile it the way you suggested. – Tim Meyer Mar 26 '13 at 11:42
  • @TimMeyer oh ok. indeed I assumed you were using a visual solution. – azf Mar 26 '13 at 12:18
0

Ever tried nmake Makefile.Release clean, that should do the job.

  • You might not have realized, but this post is 9 years old. A lot has changed since then, and I no longer have this problem, so I can't really tell if this would have worked – Tim Meyer May 10 '22 at 14:26