Group Item

This item is attached to a product and used to group files that have something in common. For example:

Application {
    Group {
        name: "common files"
        files: ["myclass.h", "myclass_common_impl.cpp"]
    }
    Group {
        name: "Windows files"
        condition: targetOS.contains("windows")
        files: "myclass_win_impl.cpp"
    }
    Group {
        name: "Linux files"
        condition: targetOS.contains("linux")
        files: "myclass_linux_impl.cpp"
    }
    Group {
        name: "Files to install"
        qbs.install: true
        qbs.installDir: "share"
        files: "runtime_resource.txt"
    }
}

When specifying files, you can use the wildcards "*", "?" and "[]", which have their usual meaning. By default, matching files are only picked up directly from the parent directory, but you can tell Qbs to consider the whole directory tree. It is also possible to exclude certain files from the list. The pattern ** used in a pathname expansion context will match all files and zero or more directories and subdirectories. For example:

        Group {
            name: "Word processing documents"
            files: ["*.doc", "*.rtf"]
            prefix: "**/"
            qbs.install: true
            qbs.installDir: "share"
            excludeFiles: "do_not_install_this_file.*"
        }

A group can also be used to attach properties to build artifacts such as executables or libraries. In the following example, an application is installed to "<install root>/bin".

Application {
    Group {
        fileTagsFilter: "application"
        qbs.install: true
        qbs.installDir: "bin"
    }
}

Groups may also appear in modules, which causes the respective sources to be added to the products depending on said module.

Group Properties

PropertyTypeDefaultDescription
namestring"Group x", where x is a unique number among all the groups in the productThe name of the group. Not used internally; mainly useful for IDEs.
fileslistempty listThe files in the group. Mutually exclusive with fileTagsFilter.
prefixstringempty stringA string to prepend to all files. Slashes are allowed and have directory semantics.
fileTagsFilterlistempty listArtifact file tags to match. Any properties set in this group will be applied to the product's artifacts whose file tags intersect with the ones listed here. Mutually exclusive with files.
conditionbooltrueDetermines whether the files in the group are actually considered part of the project.
fileTagslistempty listTags to attach to the group's files. These can then be matched by a rule. Note that file taggers are never applied to a file that has this property set.
overrideTagsbooltrueDetermines how tags on files that are listed both at the top level of a product and a group are handled. If this property is true, then the file tags set via the group replace the ones set via the product. If it is false, the "group tags" are added to the "product tags".
excludeFileslistempty listFor use with wildcards; the files in this list are "subtracted" from the files list.

© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.