[Qbs] Conditionally adding a file tag

Jochen Ulrich jochen.ulrich at clausmark.com
Wed Jul 29 09:07:19 CEST 2020


Hi Alberto!

I guess the issue here is that FileTaggers are disabled in this case:

> File taggers are disabled if file tags are set explicitly in a product or group.
> For example, the "cpp" tag is not attached to the .cpp files in the following product
(see https://doc.qt.io/qbs/qml-qbslanguageitems-filetagger.html#details)

I don't know why the behavior is like this.
But it seems you need to decide to either set the tags via a Group or via a FileTagger.

But normally, it is not a problem to set those tags via a Group when organizing the Groups accordingly.
For example you could have a dedicated Group for those resources. Something like

Group {
        name: "Resources"
        fileTags: embedAsResource ? ["qt.core.resource_data"] : []
        qbs.install: !embedAsResource
        qbs.installDir: "share/" + project.relativePluginDir
        qbs.installSourceBase: "../"
        files: [
              "file1.qml",
              "file2.qml",
              "file3..png",
              "file4.gif",
         ]
}

Best 
Jochen Ulrich



More information about the Qbs mailing list