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.

PropertyTypeDefaultDescription
conditionbooltrueIf false, the product will not be built.
namestringempty stringThe name of the product. Used to identify the product in a Depends item, for example.
typestringListempty listThe file tags matching the product's target artifacts.
targetNamestringnameThe base file name of the product's target artifacts.
destinationDirectorystring"."The directory where the target artifacts will be located. Relative to the build directory.
filesstringListempty listA list of source files. Syntactic sugar to save a Group item for simple products.
excludeFilesstringListempty listA list of source files not to include. Useful with wildcards. For more information, see Group Item.
consoleApplicationboollinker-dependentIf true, a console application is generated. If false, a GUI application is generated. Only takes effect on Windows.
qbsSearchPathsstringListproject.qbsSearchPathsSee 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.
versionstringundefinedThe 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:

PropertyTypeDescription
buildDirectorystringThe build directory for this product. This is the directory where generated files are placed.
sourceDirectorystringThe source directory for this product. This is the directory of the file where this product is defined.