Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QMake SUBDIRS project: How to call release-clean from top-level Makefile?

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)

like image 369
Tim Meyer Avatar asked Mar 07 '13 12:03

Tim Meyer


1 Answers

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
like image 161
azf Avatar answered Oct 29 '22 05:10

azf