[Interest] Adding extra target to pro file

Till Oliver Knoll till.oliver.knoll at gmail.com
Thu Jan 9 18:19:19 CET 2014


Am 09.01.2014 um 17:19 schrieb Francisco Ares <frares at gmail.com>:

> 
> 
> 2014/1/9 Igor Mironchik <igor.mironchik at gmail.com>
>> ... If so and AFAIK, you can't do this in a single .pro file

Correct: each *.pro file with either an "app" or "lib" set as template will produce exactly one binary, either an executable or (shared) library.


>> , but you can do this in a qt-creator project - in fact, there will be two projects, each having its own .pro file, and in qt-project projects manager there is a tab where you can set which project depends on which other(s).

Off course you can do the same "on the command line" (using *.pro files and qmake alone), and I strongly assume that this is exactly what Qt Creator does for you as well (as it simply manages/creates/changes the corresponding *.pro project files).

The magic keyword here is the template "subdirs"! You specify a bunch of subdirs in some "top-level" *.pro file with

  template = subdirs
  subdirs = foo \
                  bar \
                  baz


Each subdir then has its own *.pro file (with template set to "ap"p or "lib"). Make sure the generated binaries end up in some common "bin" directory, then it becomes easier for specifying the folder for linking the dependencies.

Hint: use *.pri ("Project Includes") file(s) and set common settings there, such as general compiler/linker flags for libraries, the common "bin" folder etc. Then "include" those *.pri files in the corresponding *.pro files


You can enforce the build order as given in the subdirs variable above with

  CONFIG += ordered

or you can specify dependendies explicitly with ".depends".

See the qmake documentation, check out chapter "SUBDIRS". It will become immediatelly clear :)

Cheers,
  Oliver
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20140109/a71203fa/attachment.html>


More information about the Interest mailing list