- Product Item

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
--- | --- | --- | ---
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.
type | stringList | empty list | The file tags matching the product's target artifacts.
targetName | string | `name` | The base file name of the product's target artifacts.
destinationDirectory | string | "." | The directory where the target artifacts will be located. Relative to the build directory.
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.
qbsSearchPaths | stringList | project.qbsSearchPaths | See the documentation of the Project Item property of the same name. Setting this property here will overwrite the default value inherited from the project, so use the `concat()` function if you want to add something.
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 usually are not changed by the user:

Property | Type | Description
--- | --- | ---
buildDirectory | string | The build directory for this product. This is the directory where generated files are placed.
sourceDirectory | string | The source directory for this product. This is the directory of the file where this product is defined.

Probe Item Project Item