Search code examples
qtconfigurationqmake

What does $$[QT_HOST_DATA/get] do in a Qt Feature configuration (.prf) file?


Where is the following syntax used in a feature configuration (.prf) file? defined:

$$[QT_HOST_DATA/get]

I know $$[ ... ] is to access QMake properties as explained in the Qt doc, but where is the /get part of the notation in $$[QT_HOST_DATA/get] clarified? And what does it precisely do?

Also, inside a Qt .conf file, what is the difference between include (for other .conf files) and load() (for .prf files)?

If include(some.conf) merely consists in the contents of some.conf to be literally pasted into the including .conf file, what does load() do exactly?

I have found no info about the structure of .prf files. https://doc.qt.io/qt-5/qmake-advanced-usage.html says that you can create .prf files, but says nothing about how these files are processed or should be structured?

Thanks for any clarifications you can provide!


Solution

  • where is the /get part of the notation in $$[QT_HOST_DATA/get] clarified? And what does it precisely do?

    Nowhere, except qmake source code. It looks like all qmake properties may have upto four special "subproperies": xxx/dev xxx/src xxx/raw xxx/get. However, what are they used for is a mystery. Executing qmake -query QT_HOST_DATA/get produces (on my machine) just the same value as plain $$[QT_HOST_DATA].

    I have found no info about the structure of .prf files.

    Basically, .prf is just "system include file". There are two points, though:

    1. All .prf files reside in a known location(s) pointed by QMAKEFEATURES variable.

    BTW. QMAKEFEATURES is a sort of "protected variable". I managed to change it only with the help of (another undocumented) cache() function:

    QMAKEFEATURES *= mydir # '*=' because of 3 passes under Windows
    # 'transient' prevents creation file on disk
    # only 'super' seems to work OK; no idea what's wrong with 'stash' or 'cache'
    cache(QMAKEFEATURES, set transient super) 
    # now I can load .prf from <mydir> too...
    
    1. Prf can be implicitly loaded by mentioning it in CONFIG variable. For example, CONFIG += qt (which is the default, btw.) results in include of <SomePrefix>/share/qt5/mkspecs/features/qt.prf Note that this takes place after the whole .pro was processed, so .prf file can be used to post-process user options.

    what does load() do exactly?

    It's just the version of include() designed specially for .prf. All it does, it simply includes .prf file. But, unlike CONFIG += xxx, it does this immediately, and, unlike plain include(), you shouldn't specify path and extension.