Tuesday, November 23, 2010

Using qmake from WinXP Command Line

qmake is used to create Makefiles from .pro files for QT projects.
qmake uses what you put in your project (.pro) files to decide what should go in the Makefiles it produces.

In order to test your installed qmake version type:
C:\>qmake -v
from command line but it produces an error message like:
'qmake' is not recognized as an internal or external command,
operable program or batch file.

In order to use qmake from winXP command line set following variables:
1-) Set the QMAKESPEC environment variable to point to a directory containing a description of your platform and compiler
2-) Add the 'qmake' executable to your PATH

I have installed QT4.6 at C:\Qt\4.6.0 , it can be at a different location on your disk. Execute following commands from command line respectively:

C:\>set QMAKESPEC=C:\Qt\4.6.0\mkspecs\win32-msvc
C:\>set PATH=%PATH%;C:\Qt\4.6.0\qmake

And then to check it type following.

C:\>qmake -v
QMake version 2.01a

Now you can use qmake to generate Makefiles from your .pro files.