[Interest] passing something into subdirs qmake

Vyacheslav Lanovets sol at lanovets.ru
Thu Jun 6 09:04:45 CEST 2019

On Wed, Jun 5, 2019 at 2:27 PM Kai Köhne <Kai.Koehne at qt.io> wrote:
> > I want to invent some convenient way to switch between two variations
>  > of the same app.
> How do you plan to set these?
> If it's via command line (e.g. qmake CONFIG+= ...): This will be passed automatically to SUBDIRS projects.
> If you somehow detect it otherwise: The common pattern here is to have the switch logic in a .pri file, and include it from all .pro files needing it.

Sometimes I use CONFIG+= in the "Additional arguments" parameter in Qt
Creator which is passed into command line.
But Qt Creator often looses all target settings after installing new
kits, and re-adding all command line options every time is not

The hack with write_file(".qmake.conf", ...) in the master pro file is
much more convenient. The only problem is that when *switching between
two different super pro files*, this pro file needs to be touched
(change, save, undo, save). Otherwise Qt Creator IDE does not see
To make things more confusing, when really running qmake,
".qmake.conf" is written into actual location near the pro file, but
when Qt Creator process the pro file, write_file(".qmake.conf", ...)
instruction the actual file does not change; something happens

All in all, if projects are switched rarely, write_file(".qmake.conf",
...) hack works nice. If I need to switch between two projects often,
it is not very convenient.

Am I correct that until maybe Qt 6 and cmake there is no other way but
write_file(".qmake.conf", ...)  ?


More information about the Interest mailing list