I'm writing a small qt app suite that consists of a set of small programs that work on the same set of files. They are organized like this:
/ app1/ main.cpp app2/ main.cpp app3/ main.cpp common/ project.h project.cpp somemore.h somemore.cpp appsuite.pro
When I do qmake && make
, I want the following binaries to be built:
How do I write appsuite.pro
to work like this?
I have heard something about .pri
files, but I could not figure out how to use them in my "situation".
Help appreciated,
jrh
The behavior of qmake can be customized when it is run by specifying various options on the command line. These allow the build process to be fine-tuned, provide useful diagnostic information, and can be used to specify the target platform for your project.
QMake is a build system that generates Makefiles for GNU Make or project build files for Microsoft Visual Studio. It is part of the Qt software framework by Trolltech. While it is commonly used to construct Qt-based software, any project can benefit from it.
qmake was created by Trolltech (now The Qt Company). It is distributed and integrated with the Qt application framework, and automates the creation of moc (meta object compiler) and rcc (resource compiler) sources, which are used in Qt's meta-object system and in the integration of binary resources (e.g., pictures).
One way of doing it is to have a .pro file per subdirectory.
appsuite.pro:
TEMPLATE = subdirs SUBDIRS = common app1 app2 app3 app1.depends = common app2.depends = common app3.depends = common
app1/app1.pro:
TARGET = app1 SOURCES = main.cpp INCLUDEPATH += ../common LIBS += -L../common -lcommon
The common.pro file should build a static library you can then link into the binaries.
common/common.pro:
TEMPLATE = lib CONFIG = staticlib SOURCES = project.cpp more.cpp HEADERS = project.h more.h
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With