Tutorial by Examples

qmake is a build automation tool, which is shipped with Qt framework. It does similar job to tools such as CMake or GNU Autotools, but it is designed to be used specifically with Qt. As such it is well integrated with Qt ecosystem, notably Qt Creator IDE. If you start Qt Creator and select File -&g...
If you like to organize your project by keeping source files in different subdirectories, you should know that during a build qmake will not preserve this directory structure and it will keep all the ".o" files in a single build directory. This can be a problem if you had conflicting file ...
Window.h #include <QWidget> class Window : public QWidget { Q_OBJECT public: Window(QWidget *parent = Q_NULLPTR) : QWidget(parent) {} } main.cpp #include <QApplication> #include "Window.h" int main() { QApplication app; Window window; wi...
The SUBDIRS ability of qmake can be used to compile a set of libraries, each of which depend on another. The example below is slightly convoluted to show variations with the SUBDIRS ability. Directory Structure Some of the following files will be omitted in the interest of brevity. They can be a...
A simple example to make a library (rather than an executable, which is the default). TEMPLATE variable specifies type of the project you are making. lib option allows makefile to build a library. library.pro HEADERS += library.h SOURCES += library.cpp TEMPLATE = lib # By default, qmake wil...
If you have a directory with existing source files, you can use qmake with the -project-option to create a project file. Let's assume, the folder MyProgram contains the following files: main.cpp foo.h foo.cpp bar.h bar.cpp subdir/foobar.h subdir/foobar.cpp Then by calling qmake -projec...

Page 1 of 1