Qbs

Blog Documentation Get Qbs Community
  • Qbs Manual
  • QbsModules
  • Exporter.qbs
  • Qbs 2.4.0
  • Exporter.qbs

    Provides support for generating Qbs modules from products. More...

    Since: Qbs 1.12

    Properties

    Detailed Description

    The Exporter.qbs module contains the properties and rules to create a Qbs module from the Export item of a Product.

    Such a module acts as your product's interface to other projects written in Qbs. For instance, suppose you are creating a library. To allow other products both within and outside of your project to make use of it, you would write something like the following:

    DynamicLibrary {
        name: "mylibrary"
        qbs.installPrefix: "/opt/mylibrary"
        Depends { name: "Exporter.qbs" }
        property string headersInstallDir: "include"
        // ...
        Group {
            name: "API headers"
            files: ["mylib.h"]
            qbs.install: true
            qbs.installDir: headersInstallDir
        }
        Group {
            fileTagsFilter: ["Exporter.qbs.module"]
            qbs.installDir: "qbs/modules/mylibrary"
        }
        Export {
            Depends { name: "cpp" }
            cpp.includePaths: [exportingProduct.sourceDirectory]
            prefixMapping: [{
                    prefix: exportingProduct.sourceDirectory,
                    replacement: FileInfo.joinPaths(exportingProduct.qbs.installPrefix,
                                                    exportingProduct.headersInstallDir)
                }]
        }
    }

    To build against this library, from within your project or any other one, you simply declare a dependency:

    Depends { name: "mylibrary" }

    Relevant File Tags

    TagSinceDescription
    "Exporter.qbs.module"1.12.0This tag is attached to the generated module file.

    Property Documentation

    additionalContent : string

    The value of this property will be copied verbatim into the generated module.

    Default: undefined


    artifactTypes : stringList

    Artifacts that match these tags will become target artifacts of the generated module, so they can get picked up by the rules of depending products.

    If you do not specify anything here, all installed artifacts of the product are considered.

    Note: You can only limit the default set of artifacts by setting this property, but you cannot extend it, because only artifacts that are to be installed are considered.

    Default: undefined


    excludedDependencies : stringList

    Normally, all Depends items in the Export item are copied into the generated module. However, if there are any exported dependencies that only make sense for products in the same project, then you can enter their names into this array, and they will get filtered out.

    Note: You should strive to structure your projects in such a way that you do not need to set this property.

    Default: undefined


    fileName : string

    The name of the generated module file.

    Default: product.targetName + ".qbs"