- Qbs Manual
- Product Item
- Qt Build Suite 1.4.1

Probe Item Project Item

# Product Item

A product typically represents the result of a build process. It specifies a set of input and output files and a way to transform the former into the latter. For example, the following product sets up a very simple C++ application:

    Product {
        name: "helloworld"
        type: "application"
        files: "main.cpp"
        Depends { name: "cpp" }
    }

The `type` property specifies what will be built (an executable). The `files` property specifies the input files (one C++ source file), and the `Depends` item pulls in the logic from the `cpp` module about how to do the necessary transformations. For some often-used types of products, Qbs pre-defines special derived items that save users some typing. These are:

- Application
- CppApplication
- DynamicLibrary
- StaticLibrary

Therefore, the above example could also be written like this:

    CppApplication {
        name: "helloworld"
        files: "main.cpp"
    }

Any property `prop` attached to this item is available in sub-items as `product.prop`, as well as in modules that are loaded from this product.

Property | Type | Default | Description
--- | --- | --- | ---
builtByDefault | bool | true | If false, the product will only be built if this is explicitly requested, either by listing the product name as an argument to `--products` or by giving the `build` command the `--all-products` option.
condition | bool | true | If false, the product will not be built.
name | string | empty string | The name of the product. Used to identify the product in a `Depends` item, for example. The value of this property must be a simple JavaScript expression that does not depend on module properties or values that are non-local to this product.
                CppApplication {
                    name: "hello" + "world"                     // valid
                }
                CppApplication {
                    name: "app_for_" + qbs.targetOS.join("_")   // invalid
                }
To change the name of your product's target artifact, modify `Product.targetName` instead.
profiles | stringList | `[project.profile]` | The profiles for which the product should be built. For each profile listed here, one instance of the product will be built according to the properties set in the respective profile. This property is only relevant for projects that require products being built for different architectures. Otherwise it can be left at its default value.
type | stringList | empty list | The file tags matching the product's target artifacts.
targetName | string | `name` with illegal file name characters replaced by underscores | The base file name of the product's target artifacts.
destinationDirectory | string | product.buildDirectory | The directory where the target artifacts will be located. If a relative path is given, the base directory will be `project.buildDirectory`.
files | stringList | empty list | A list of source files. Syntactic sugar to save a `Group` item for simple products.
excludeFiles | stringList | empty list | A list of source files not to include. Useful with wildcards. For more information, see Group Item.
consoleApplication | bool | linker-dependent | If true, a console application is generated. If false, a GUI application is generated. Only takes effect on Windows. This property also influences the default application type on OS X and iOS. If true, an application bundle is generated. If false, a normal executable is generated.
qbsSearchPaths | stringList | project.qbsSearchPaths | See the documentation of the Project Item property of the same name. The value set here will be merged with the one inherited from the project.
version | string | undefined | The version number of the product. Used in shared library filenames and generated Info.plist files in OS X and iOS application and framework bundles, for example.

The following properties are automatically set by Qbs and cannot be changed by the user:

Property | Type | Description
--- | --- | ---
buildDirectory | path | The build directory for this product. This is the directory where generated files are placed.
profile | string | The profile for building this particular instance of the product. Derived automatically from the `profiles` property.
sourceDirectory | path | The source directory for this product. This is the directory of the file where this product is defined.

Probe Item Project Item