- Qbs Manual
- Qbs 1.24.0

Probe ◦ Profile

# Product

Represents the result of a build process. More...

Inherited By: | AppleDiskImage, Application, InnoSetup, InstallPackage, JavaClassCollection, JavaJarFile, and Library

- List of all members, including inherited members

## Properties

- aggregate : bool
- buildDirectory : path
- builtByDefault : bool
- condition : bool
- consoleApplication : bool
- destinationDirectory : string
- excludeFiles : stringList
- files : stringList
- multiplexByQbsProperties : stringList
- multiplexedType : stringList
- name : string
- qbsModuleProviders : stringList
- qbsSearchPaths : stringList
- sourceDirectory : path
- targetName : string
- type : stringList
- version : string

## Detailed Description

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.

## Multiplexing Properties

The following properties are relevant for product multiplexing only. Unless multiplexing is desired, they can be left at their default values:

- aggregate
- multiplexedType
- multiplexByQbsProperties

Note: We do not promise backwards compatibility for multiplexing properties as they are likely to change in future Qbs versions.

## Read-Only Properties

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

- buildDirectory
- sourceDirectory

## Property Documentation

aggregate : bool

If `true`, an aggregate product will be created that has dependencies on all multiplex instances of this product.

Note: If you do not want to do multiplexing, you can use the default value `undefined`.

[read-only] buildDirectory : path

The build directory for this product. This is the directory where generated files are placed.

The value of this property is automatically set by Qbs and cannot be changed by the user.

builtByDefault : bool

Determines whether the product will be built.

If `false`, the product will only be built if this is explicitly requested, either by listing the product name as an argument to the --products option or by using the --all-products option of the build command.

Default: `true`

condition : bool

Determines whether the product will be built.

If `false`, the product will not be built.

Default: `true`

consoleApplication : bool

On Windows, determines whether a console or GUI application is generated.

If `true`, a console application is generated. If `false`, a GUI application is generated.

On Apple platforms, influences the default application type.

If `true`, a normal executable is generated. If `false`, an application bundle is generated.

Default: Linker-dependent

destinationDirectory : string

The directory where the target artifacts will be located. If a relative path is given, the base directory will be project.buildDirectory.

Default: `product.buildDirectory`

excludeFiles : stringList

A list of source files not to include. Useful with wildcards. For more information, see Group.

Default: An empty list

files : stringList

A list of source files. Syntactic sugar to save a Group item for simple products.

Relative paths are resolved using the parent directory of the project file that sets the property.

Default: An empty list

multiplexByQbsProperties : stringList

Specifies which properties of the qbs module will be used for product multiplexing:

- architectures
- buildVariants
- profiles

The value must be a subset of the above values.

Note: If you do not want to do multiplexing, you can use the default value `["profiles"]`.

multiplexedType : stringList

Specifies the product type for the multiplexed product instances.

Note: If you do not want to do multiplexing, you can use the default value `undefined`.

name : 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_" + qbs.targetOS.join("_")
         // invalid
     }

To change the name of your product's target artifact, modify targetName instead.

Default: An empty string

qbsModuleProviders : stringList

The list of Module Providers to use for this product.

Overrides Project.qbsModuleProviders.

This property was introduced in Qbs 1.21.

See also Project::qbsModuleProviders.

qbsSearchPaths : stringList

A list of paths that are searched for imports, modules and module providers.

The value set here will be merged with the value of project.qbsSearchPaths.

For the details about how to add custom items, see the Custom Modules and Items page.

Default: project.qbsSearchPaths

[read-only] sourceDirectory : path

The source directory for this product. This is the directory of the file where this product is defined.

The value of this property is automatically set by Qbs and cannot be changed by the user.

targetName : string

The base file name of the product's target artifacts.

Default: The value of name with illegal file name characters replaced by underscores.

type : stringList

The file tags matching the product's target artifacts.

Default: An empty list

version : string

The version number of the product. Used in shared library filenames and generated Info.plist files in Apple application and framework bundles, for example.

Default: Undefined

Probe ◦ Profile