Why does Qt use its own make tool, qmake?

Trevor Boyd Smith picture Trevor Boyd Smith · Sep 2, 2009 · Viewed 24.1k times · Source

I just started using Qt and noticed that it uses its own make tool, qmake.

  • Why does Qt use its own make tool?
  • Is there something special that prevents it from using a standard make tool?
  • Does qmake call the GCC C++ compiler?

Answer

Thomi picture Thomi · Sep 2, 2009

Qt uses qmake to transparently support Qt's various addons, including "moc, the meta-object compiler" (which provides signals & slots), "uic, the ui compiler" (which creates header files from .ui designer files), "rcc, the resource compiler" (which compiles resources).

There's nothing to stop you using any build system you want. however, it's a lot more work. For example, you need to run "moc" over every header file that contains a class that has signals or slots. In general it's not recommended, especially for someone who's just starting to use Qt.

QMake does not call g++/gcc directly. Instead, qmake creates native make files on your current platform. Under linux it creates standard GNU make files, under windows it can generate visual studio make files, under Mac OS X it can generate XCode project files. You then invoke your native build system (either GNU make, or MS NMake, or xcodebuild or whatever), which will call your native compiler (g++/gcc or whatever).