[Interest] QMake commands, QML preprocessing

Konstantin Tokarev annulen at yandex.ru
Mon Feb 13 15:55:03 CET 2012



13.02.2012, 18:19, "Harri Pasanen" <harri at mpaja.com>:
> Hi,
>
> I'm wondering what would be the recommended way to pre-process QML?
>
> # Add more folders to ship with the application, here
> folder_01.source = qml/n9test
> folder_01.target = qml
> DEPLOYMENTFOLDERS = folder_01
>
> At deployment time I'd like to change the QML, but keep the unchanged copy
> in version control.
>
> There are some hooks for adding preprocessing for C++, but does
> something equivalent exist for QML?
>
> In this particular case I would like to have VERSION variable as
> a macro inside QML, so that it would automatically expand to the same
> as defined in .pro, rather than having to edit in manually.

You need to use QMAKE_SUBSTITUTES. Example:

// test.pro
TARGET = app
FOO = bar
QMAKE_SUBSTITUTES += test.in

// test.in
$$FOO

Running qmake produces file "test" containing "bar".

-- 
Regards,
Konstantin



More information about the Interest mailing list