- Qbs Manual
- Module qbs
- Qbs 1.5.1

# Module qbs

The `qbs` module is implicitly loaded in every product. It contains properties of the current build environment, independent of the used programming languages and toolchains.

## General Properties

Property | Type | Since | Default | Description
--- | --- | --- | --- | ---
buildVariant | `string` | 1.0 | `"debug"` | Contains the name of the build variant for the current build.
debugInformation | `bool` | 1.0 | `true` for debug builds, `false` otherwise | Specifies whether to generate debug information.
enableDebugCode | `bool` | 1.0 | `true` for debug builds, `false` otherwise | Specifies whether to compile debug code in the product. This is typically enabled for debug builds and disabled for release builds.
optimization | `string` | 1.0 | `"none"` for debug builds, `"fast"` for release builds | Specifies the general type of optimization that should be performed by all toolchains. Allowed values: `"none"`, `"fast"`, `"small"`
targetOS | `stringList` | 1.0 | `undefined` | Specifies the OS you want to build the project for. This is typically set in a profile. Possible values include one or more of the following: `"aix"`, `"android"`, `"blackberry"`, `"bsd"`, `"bsd4"`, `"bsdi"`, `"cygwin"`, `"darwin"`, `"dgux"`, `"dynix"`, `"freebsd"`, `"hpux"`, `"hurd"`, `"integrity"`, `"ios"`, `"ios-simulator"`, `"irix"`, `"linux"`, `"lynx"`, `"osx"`, `"msdos"`, `"nacl"`, `"netbsd"`, `"openbsd"`, `"os2"`, `"os2emx"`, `"osf"`, `"qnx"`, `"qnx6"`, `"reliant"`, `"sco"`, `"solaris"`, `"symbian"`, `"ultrix"`, `"unix"`, `"unixware"`, `"vxworks"`, `"windows"`, `"windowsce"`, `"windowsphone"`, `"winrt"`
architecture | `string` | 1.0 | `undefined` | Specifies the target platform's processor architecture. `undefined` indicates that the target platform is architecture-independent (for example the CLR or JVM). This is typically set in a profile. Commonly used values are: `"x86"`, `"x86_64"` and `"arm"`.
toolchain | `stringList` | 1.0 | `undefined` | Specifies the attributes of the toolchain that is going to be used for this build. Typical values include: `"gcc"`, `"llvm"`, `"clang"`, `"mingw"`, `"msvc"`
sysroot | `string` | 1.0 | `undefined` | Specifies the sysroot of the target platform. This property is typically set in a profile for cross-compiling.
pathListSeparator | `string` | 1.0 | `";"` on Windows, `":"` on Unix | Holds the platform-specific separator for path list that is used in environment variables or other contexts.
nullDevice | `string` | 1.4.2 | `"NUL"` on Windows, `"/dev/null"` on Unix | Holds the platform-specific file path corresponding to the null device.
shellPath | `path` | 1.5 | `"%COMSPEC%"` on Windows, `"/bin/sh"` on Unix | Holds the platform-specific file path corresponding to the command line interpreter. On Windows this is the path to `cmd.exe`, which is held in the `COMSPEC` environment variable - typically `C:/Windows/System32/cmd.exe`, and on Unix-like platforms this is `/bin/sh`.

## Environment Properties

This section lists constant, read-only properties set by Qbs internally. These properties should not be overridden.

Property | Type | Since | Default | Description
--- | --- | --- | --- | ---
hostOS | `stringList` (read only) | 1.0 | `undefined` | This property is set by Qbs internally and specifies the OS Qbs is running on. The possible values for this property are the values of `targetOS`, though some may not be supported.
hostOSVersion | `string` (read only) | 1.2 | `undefined` | The host operating system version. Currently only defined for Windows and Apple platforms. Consists of two or three numbers separated by dots, for instance "10.9" or "6.3.9600".
hostOSBuildVersion | `string` (read only) | 1.2 | `undefined` | The host operating system's build version. Currently only defined for Windows and Apple platforms. On Windows, this is the 4 or 5 digit Windows build number and is equivalent to `versionPatch`. On Apple platforms, this is a standard build number in the Apple versioning scheme, for instance "13C64".
hostOSVersionMajor | `int` (read only) | 1.2 | `hostOSVersionParts[0]` | The host operating system major version.
hostOSVersionMinor | `int` (read only) | 1.2 | `hostOSVersionParts[1]` | The host operating system minor version.
hostOSVersionParts | `list` (read only) | 1.2 | `empty` | The host operating system version as a list. For instance, Windows 8.1 (version 6.3.9600) would correspond to a value of `[6, 3, 9600]`.
hostOSVersionPatch | `int` (read only) | 1.2 | `hostOSVersionParts[2]` | The host operating system patch level.
version | `string` (read only) | 1.4.1 |  | Version number of Qbs as a string, i.e. "1.4.1".
versionMajor | `int` (read only) | 1.4.1 |  | Major version number of Qbs.
versionMinor | `int` (read only) | 1.4.1 |  | Minor version number of Qbs.
versionPatch | `int` (read only) | 1.4.1 |  | Patch version number of Qbs.

## Installation Properties

This section lists properties specific to the Qbs installation mechanism. See Installing Files for more information.

Property | Type | Since | Default | Description
--- | --- | --- | --- | ---
install | `bool` | 1.0 | `false` | Specifies whether to install a certain set of files. This is typically set in a `Group` item to mark a number of files as installable. Note: Artifacts for which this property is enabled automatically receive the file tag "installable". This is useful for writing packaging-related rules.
installSourceBase | `string` | 1.4 | see below | Specifies the base directory of the local files that are going to be installed. The source base directory is omitted from the target directory path specified in `installDir`. The default value of this property is the directory of the current file to be installed, relative to the product's source directory.
installDir | `string` | 1.0 | `undefined` | Specifies the installation directory for the files of a product or a `Group`. The value of this property is a path that is relative to `installPrefix`.
installPrefix | `string` | 1.1 | `empty` | Specifies the global installation prefix. It is implicitly prepended to all values of `installDir`. The `installPrefix` itself is relative to the `installRoot` in the context of installation.
installRoot | `string` | 1.4 | `<build dir>/install-root` | Specifies the global installation root. It is implicitly prepended to all values of `installPrefix` in the context of installation. Note: This property is fundamentally different from `installDir` and `installPrefix` in that it must not be visible to the code being built. In fact, the install root is often just a temporary location used to package the binaries, which should therefore not assume they will be in that location at run-time.