cpp

Provides C/C++ support. More...

Since: Qbs 1.0

Properties

Detailed Description

The cpp module contains the properties and rules for toolchains of the C/C++ family. On Apple platforms, this includes support for Objective-C/C++.

Setting Up the Run Environment

When running an application that has dependencies on dynamic libraries, the script specified by Module.setupRunEnvironment automatically adds the locations of the libraries to the environment. That is, to PATH on Windows, DYLD_LIBRARY_PATH on macOS, and LD_LIBRARY_PATH on Linux and other Unix platforms. If the value "ignore-lib-dependencies" shows up in the config array, this behavior is disabled. Users can set the value via the run command.

Dependency Parameters

ParameterTypeSinceDefaultDescription
linkbool1.9undefinedIf false, the dependency will not be linked, even if it is a valid input for a linker rule. This property affects library dependencies only.
linkWholeArchivebool1.9undefinedIf true, then if the dependency is a static library, all of its objects will be pulled into target binary, even if their symbols do not appear to be used. This parameter is mainly useful when creating a dynamic library from static libraries.
symbolLinkModestring1.9undefinedAttribute specifying how the library or framework will be linked. May contain the values: "weak", "lazy", "reexport", and "upward"; refer to the Apple ld64 man page for full details. undefined uses normal linking. Currently only applies when linking for Apple platforms.

Relevant File Tags

TagAuto-tagged File NamesSinceDescription
"application"n/a1.0.1The rule that creates executable files (typically via a linker) attaches this tag to its output artifact.
"asm"*.s (for GCC-like toolchains), *.asm (for MSVC)1.1.0Source files with this tag serve as inputs to a rule invoking the toolchain's assembler. One object file is generated for each such file.
"asm_cpp"*.S, *.sx1.1.0Like "asm", but for source files that need preprocessing. This tag only has an effect with GCC-like toolchains.
"c"*.c (if combineCSources is not enabled)1.0.1Source files with this tag serve as inputs to a rule invoking the toolchain's C compiler. One object file is generated for each such file.
"c.combine"*.c (if combineCSources is enabled)1.8Source files with this tag serve as inputs to a rule combining them into a single C file, which will then be compiled.
"cpp"*.C, *.cpp, *.cxx, *.c++, *.cc (if combineCxxSources is not enabled)1.0.1Source files with this tag serve as inputs to a rule invoking the toolchain's C++ compiler. One object file is generated for each such file.
"cpp.combine"*.C, *.cpp, *.cxx, *.c++, *.cc (if combineCxxSources is enabled)1.8Source files with this tag serve as inputs to a rule combining them into a single C++ file, which will then be compiled.
"c_pch_src", "cpp_pch_src", "objc_pch_src", "objcpp_pch_src"-1.5Files with this tag will be turned into precompiled headers for C, C++, Objective-C and Objective-C++, respectively. There can be only one such file per product and language.
"dynamiclibrary"n/a1.0.1The rule that creates dynamic libraries (typically via a linker) attaches this tag to its output artifact.
"hpp"*.h, *.H, *.hpp, *.hxx, *.h++1.0.1This tag is used for header files (C, C++, Objective-C and Objective-C++). No rule in this module generates output artifacts from such files directly, but the compiler rule will have a dependency on all rules that create such files.
"linkerscript"-1.5.0This tag is used for ld linker scripts. You can provide such a file if you need to replace the default linker script. This file tag only has an effect with GCC-like toolchains. The linker needs to be ld-compatible.
"obj"n/a1.0.1The rule that creates object files (typically via a compiler) attaches this tag to its output artifacts. Such files are usually intermediate artifacts of the build process and rarely need to be referenced in project files.
"objc"*.m (if combineObjcSources is not enabled)1.1.0Source files with this tag serve as inputs to a rule invoking the toolchain's Objective-C compiler. One object file is generated for each such file.
"objc.combine"*.m (if combineObjcSources is enabled)1.8Source files with this tag serve as inputs to a rule combining them into a single Objective-C file, which will then be compiled.
"objcpp"*.mm (if combineObjcxxSources is not enabled)1.1.0Source files with this tag serve as inputs to a rule invoking the toolchain's Objective-C++ compiler. One object file is generated for each such file.
"objcpp.combine"*.mm (if combineObjcxxSources is enabled)1.8Source files with this tag serve as inputs to a rule combining them into a single Objective-C++ file, which will then be compiled.
"rc"*.rc1.1.0Files with this tag serve as inputs to the Windows resource compiler. One object file is generated for each such file. The tag has no effect on target platforms other than Windows.
"staticlibrary"n/a1.0.1The rule that creates static libraries (typically via a linker) attaches this tag to its output artifact.
"versionscript"-1.5.0This tag is used for ld linker scripts. You can provide such a file if you need fine-grained control over the symbols present in a shared library. This file tag only has an effect with GCC-like toolchains. The linker needs to be ld-compatible.

Property Documentation

allowUnresolvedSymbols : bool

Set to true if you want the linking step to succeed even if the resulting binary contains unresolved symbols. Normally, this makes little sense, but in special cases it is possible that the respective symbols will be available at load time even if they are not present during linking.

Default: Undefined

This property was introduced in Qbs 1.2.


alwaysUseLipo : bool

Whether to always use lipo when combining Mach-O output files on Apple platforms, even if there is only one CPU architecture. This value should not normally need to be changed.

Default: false

This property was introduced in Qbs 1.9.


architecture : string

The target architecture.

Default: qbs.architecture


archiverName : string

This property is specific to Unix platforms.

The name of the archiver binary. This property is set in the build profile.

Default: "ar"


archiverPath : string

This property is specific to Unix platforms.

The full path of the archiver binary. This property is set in the build profile.

Default: Determined by qbs setup-toolchains.


assemblerFlags : stringList

A list of additional flags for the assembler.

Default: Undefined

This property was introduced in Qbs 1.5.


assemblerName : string

The name of the assembler binary. This property is set in the build profile.

Default: Determined by qbs setup-toolchains.

This property was introduced in Qbs 1.5.


assemblerPath : string

The full path of the assembler binary. This property is set in the build profile.

Default: Determined by qbs setup-toolchains.

This property was introduced in Qbs 1.5.


automaticReferenceCounting : bool

This property is specific to Apple platforms.

Whether to enable Automatic Reference Counting (ARC) for Objective-C and Objective-C++ source code.

If left undefined, uses the compiler default (probably false).

Default: Undefined

This property was introduced in Qbs 1.4.


cFlags : stringList

A list of additional flags for the C compiler.

Default: Undefined


cLanguageVersion : stringList

The version of the C standard with which the code must comply.

If this property is set, the corresponding compiler and linker flags will be added, depending on the toolchain.

If the value is left undefined, the compiler default will be used. If the list contains more than one value, the highest version is chosen.

Possible values include: "c89", "c99", "c11".

Default: Undefined

This property was introduced in Qbs 1.4.


combineCSources : bool

Enabling this property on a product instructs the file tagger to attach the tag "c.combine" to C sources, rather than "c". As a result, all C sources of the product will be combined into a single file, which is then compiled.

This can speed up initial compilation significantly, but is of course detrimental in the context of incremental builds. Also, perfectly legal code may fail to compile with this option due to the merging of translation units.

To enable this property in a product that has sources that cannot be merged, put the sources into a dedicated Group and set their fileTags property to "c", overriding the file tagger.

Note: Module properties set on specific source files (that is, at the Group level) will not be taken into account when building the combined file. You either need to set these properties at the product level or prevent the respective files from getting combined via the mechanism described above.

Default: false

This property was introduced in Qbs 1.8.


combineCxxSources : bool

Like combineCSources, but for C++. The relevant file tags are "cpp" and "cpp.combine".

Default: false

This property was introduced in Qbs 1.8.

See also combineCSources.


combineObjcSources : bool

Like combineCSources, but for Objective-C. The relevant file tags are "objc" and "objc.combine".

Default: false

This property was introduced in Qbs 1.8.

See also combineCSources.


combineObjcxxSources : bool

Like combineCSources, but for Objective-C++. The relevant file tags are "objcpp" and "objcpp.combine".

Default: false

This property was introduced in Qbs 1.8.

See also combineCSources.


commonCompilerFlags : stringList

A list of flags that are added to all compilation commands independently of the language.

Default: Undefined

This property was introduced in Qbs 1.0.1.


compilerDefinesByLanguage : var

A string to string to string map of language tags to list of preprocessor macros that are used for all projects that are using the current toolchain.

User project files usually do not set this property.

Note: This property will not be usable without also setting enableCompilerDefinesByLanguage.

Default: Undefined

This property was introduced in Qbs 1.10.


compilerFrameworkPaths : pathList

A list of framework search paths that are used for all projects that are using the current toolchain.

User project files usually do not set this property.

Default: Determined automatically by probing the compiler.

This property was introduced in Qbs 1.6.


compilerIncludePaths : pathList

A list of #include search paths that are used for all projects that are using the current toolchain.

User project files usually do not set this property.

Default: Determined automatically by probing the compiler.

This property was introduced in Qbs 1.6.


compilerLibraryPaths : pathList

A list of library search paths that are used for all projects that are using the current toolchain.

User project files usually do not set this property.

Default: Determined automatically by probing the compiler.

This property was introduced in Qbs 1.6.


compilerName : string

The name of the main compiler binary. This property is set in the build profile.

Default: Determined by qbs setup-toolchains.


compilerPath : string

The full path of the main compiler binary. This property is set in the build profile.

If the toolchain provides different compilers for different languages, compilerPathByLanguage is used.

Default: Determined by qbs setup-toolchains.


compilerPathByLanguage : var

A string to string map that maps file tags to full paths of compiler binaries. This property is set in the build profile.

Default: Determined by qbs setup-toolchains.

This property was introduced in Qbs 1.3.


compilerVersionMajor : int

The major version of the compiler.

Default: Undefined

This property was introduced in Qbs 1.4.


compilerVersionMinor : int

The minor version of the compiler.

Default: Undefined

This property was introduced in Qbs 1.4.


compilerVersionPatch : int

The patch level component of the compiler version.

Default: Undefined

This property was introduced in Qbs 1.4.


compilerWrapper : stringList

A wrapper binary and its arguments for wrapping compiler calls. This is useful for compiler wrappers, such as ccache.

Default: Undefined

This property was introduced in Qbs 1.1.


cppFlags : stringList

A list of additional flags for the C preprocessor.

Default: Undefined


cxxFlags : stringList

A list of additional flags for the C++ compiler.

Default: Undefined


cxxLanguageVersion : stringList

The version of the C++ standard with which the code must comply.

If this property is set, the corresponding compiler and linker flags will be added, depending on the toolchain.

If the value is left undefined, the compiler default will be used. If the list contains more than one value, the highest version is chosen.

Possible values include: "c++98", "c++11", "c++14", "c++17".

Default: Undefined

This property was introduced in Qbs 1.4.


cxxStandardLibrary : string

The C++ standard library to link to.

If this property is set, the corresponding compiler and linker flags will be added, assuming the value is valid for the current toolchain.

If the value is left undefined, the compiler default will be used.

Possible values include: "libstdc++", "libc++".

Default: Undefined

This property was introduced in Qbs 1.4.


debugInformation : bool

Whether to generate debug information.

Default: qbs.debugInformation


defines : stringList

A list of preprocessor macros that gets passed to the compiler.

To set macro values, use the following syntax:

cpp.defines: ["USE_COLORS=1", 'COLOR_STR="blanched almond"']

Default: Undefined


discardUnusedData : bool

If this property is true, the linker will discard data from objects that it determines to be unused. With MSVC and on Apple platforms, the granularity is per symbol, elsewhere it is per section.

Default: Undefined

This property was introduced in Qbs 1.10.


distributionFrameworkPaths : pathList

A list of distribution-specific framework search paths, prioritized after systemFrameworkPaths.

Intended for use by module authors implementing support for new operating systems or distributions.

User project files should not set this property.

Default: Undefined

This property was introduced in Qbs 1.8.


distributionIncludePaths : pathList

A list of distribution-specific include paths that are passed as system include paths to the compiler, prioritized after systemIncludePaths.

Intended for use by module authors implementing support for new operating systems or distributions.

User project files should not set this property.

Default: Undefined

This property was introduced in Qbs 1.8.


distributionLibraryPaths : pathList

A list of distribution-specific library search paths.

Intended for use by module authors implementing support for new operating systems or distributions.

User project files should not set this property.

Default: Undefined

This property was introduced in Qbs 1.8.


driverFlags : stringList

A list of flags that are added to all compilation and linking commands performed by the compiler driver, independently of the language.

Default: Undefined

This property was introduced in Qbs 1.6.


driverLinkerFlags : stringList

A list of flags that are added to all linking commands performed by the compiler driver, independently of the language.

Default: Undefined

This property was introduced in Qbs 1.11.


dsymutilFlags : stringList

This property is specific to Apple platforms.

Additional flags for the dsymutil tool.

Note: If this property contains the -f or --flat options, this will cause Qbs to generate "flat" (single-file) .dwarf debug symbol files instead of .dSYM bundles (directories) when separateDebugInformation is set to true.

Default: Undefined

This property was introduced in Qbs 1.4.1.


dsymutilPath : string

This property is specific to Apple platforms.

The full path of the dsymutil binary. This property is set in the build profile.

Default: Determined by qbs setup-toolchains.

This property was introduced in Qbs 1.4.


dynamicLibraries : stringList

A List of dynamic libraries to be linked.

If the library is part of your project, consider using a Depends item instead.

Default: Undefined


enableCompilerDefinesByLanguage : stringList

A list of languages (one or more of "c", "cpp", "objc", "objcpp") to extract the list of default compiler defines for in compilerDefinesByLanguage.

Because this has performance implications, no languages are enabled by default.

Default: Undefined

This property was introduced in Qbs 1.10.


enableExceptions : bool

Whether to enable exceptions in C++ code.

Default: true

This property was introduced in Qbs 1.5.


enableReproducibleBuilds : bool

Whether the compiler should try to generate reproducible object files.

Some compilers (notably GCC) use random numbers for generating symbol names that have to be different in every compilation unit. This is avoided by setting this property to true.

Default: false

This property was introduced in Qbs 1.5.


enableRtti : bool

Whether to enable runtime type information in C++ code.

Default: Undefined

This property was introduced in Qbs 1.5.


endianness : string

Specifies the endianness of the target platform's processor architecture ("big" or "little").

The value is automatically detected from the compiler's default values, but can also be manually set in order to select a specific endianness when targeting bi-endian architectures like MIPS and PowerPC.

Default: Compiler default value.

This property was introduced in Qbs 1.9.


entryPoint : string

The name of the entry point of an executable or dynamic library.

If this property is left undefined, the toolchain's default is used.

Default: Undefined

This property was introduced in Qbs 1.3.


exceptionHandlingModel : string

The exception handling model to use.

For MSVC, this can be "default", "seh" or "externc". For all other compilers, "default" indicates the default or the only exception handling model.

Default: "default"

This property was introduced in Qbs 1.5.


exportedSymbolsCheckMode : string

This property is specific to Unix platforms.

Controls how Qbs determines whether an updated dynamic library causes relinking of dependents.

The default value is "ignore-undefined", which means that undefined symbols being added or removed do not cause any relinking. If that should happen, for example because dependent products are linked with an option such as "--no-undefined", this property can be set to "strict".

Default: "ignore-undefined"

This property was introduced in Qbs 1.4.1.


frameworkPaths : pathList

This property is specific to Apple platforms.

A list of framework search paths.

Relative paths are considered to be relative to the .qbs product file they are used in.

Default: Undefined


frameworks : stringList

This property is specific to Apple platforms.

A list of frameworks to be linked.

If the framework is part of your project, consider using a Depends item instead.

Default: Undefined


generateManifestFile : bool

This property is specific to Windows.

Whether to auto-generate a manifest file and include it in the binary.

Set this property to false if you provide your own rc file.

Default: true

This property was introduced in Qbs 1.5.0.


includePaths : pathList

A list of include paths.

Relative paths are considered to be relative to the .qbs product file they are used in.

Default: Undefined


libraryPaths : pathList

A list of library search paths.

Relative paths are considered to be relative to the .qbs product file they are used in.

Default: Undefined


linkerFlags : stringList

A list of additional flags for the linker.

These flags should not be escaped using the -Wl or -Xlinker syntaxes, as Qbs will do this automatically based on the linker being used.

Default: Undefined

See also linkerMode.


linkerMode : string

This property is specific to Unix platforms.

Controls whether to automatically use an appropriate compiler frontend instead of the system linker when linking binaries.

The default is "automatic", which chooses either the C++ compiler, C compiler, or system linker specified by the linkerName and linkerPath properties, depending on the type of object files present on the linker command line.

Set this property to "manual" to explicitly specify the linker using the linkerName and linkerPath properties.

Default: "automatic"

This property was introduced in Qbs 1.6.


linkerName : string

The name of the linker binary. This property is set in the build profile.

Default: Determined by qbs setup-toolchains.

This property was introduced in Qbs 1.1.1.


linkerPath : string

The full path of the linker binary. This property is set in the build profile.

Default: Determined by qbs setup-toolchains.

This property was introduced in Qbs 1.1.1.


linkerWrapper : stringList

A wrapper binary and its arguments for wrapping linker calls. This is useful for linker wrappers as needed by Bullseye Coverage, for example.

Default: Undefined

This property was introduced in Qbs 1.6.2.


lipoPath : string

This property is specific to Apple platforms.

The full path of the lipo binary.

Default: Determined automatically.

This property was introduced in Qbs 1.9.


minimumIosVersion : string

This property is specific to Apple platforms.

A version number in the format [major].[minor] indicating the earliest version of iOS that the product should run on.

Passes -miphoneos-version-min=<version> to the compiler.

If left undefined, compiler defaults will be used.

Default: Undefined


minimumMacosVersion : string

This property is specific to Apple platforms.

A version number in the format [major].[minor]indicating the earliest version of macOS that the product should run on.

Passes -mmacosx-version-min=<version> to the compiler.

If left undefined, compiler defaults will be used.

Default: Undefined

This property was introduced in Qbs 1.5.2.


minimumTvosVersion : string

This property is specific to Apple platforms.

A version number in the format [major].[minor] indicating the earliest version of Apple tvOS that the product should run on.

If left undefined, compiler defaults will be used.

Default: Undefined

This property was introduced in Qbs 1.5.


minimumWatchosVersion : string

This property is specific to Apple platforms.

A version number in the format [major].[minor] indicating the earliest version of Apple watchOS that the product should run on.

If left undefined, compiler defaults will be used.

Default: Undefined


minimumWindowsVersion : string

This property is specific to Windows.

A version number in the format [major].[minor] indicating the earliest version of Windows that the product should run on.

Defines WINVER, _WIN32_WINNT, and _WIN32_WINDOWS, and applies a version number to the linker flags /SUBSYSTEM and /OSVERSION for MSVC or --major-subsystem-version, --minor-subsystem-version, --major-os-version, and --minor-os-version for MinGW.

If left undefined, compiler defaults will be used.

Default: Undefined


nmName : string

This property is specific to Unix platforms.

The name of the nm binary. This property is set in the build profile.

Default: "nm"

This property was introduced in Qbs 1.2.


nmPath : string

This property is specific to Unix platforms.

The full path of the nm binary. This property is set in the build profile.

Default: Determined by qbs setup-toolchains.

This property was introduced in Qbs 1.2.


objcFlags : stringList

A list of additional flags for the Objective-C compiler.

Default: Undefined


objcopyName : string

This property is specific to Unix platforms.

The name of the objcopy binary. This property is set in the build profile.

Default: "objcopy"

This property was introduced in Qbs 1.4.


objcopyPath : string

This property is specific to Unix platforms.

The full path of the objcopy binary. This property is set in the build profile.

Default: Determined by qbs setup-toolchains.

This property was introduced in Qbs 1.4.


objcxxFlags : stringList

A list of additional flags for the Objective-C++ compiler.

Default: Undefined


optimization : string

The optimization level.

Default: qbs.optimization


platformDefines : stringList

A list of preprocessor macros that are used for all projects that are built for the current target platform. User project files usually do not set this property.

Default: Undefined


positionIndependentCode : bool

This property is specific to Unix platforms.

Whether to generate position-independent code.

If this property is left undefined, position-independent code is generated for libraries, but not for applications.

Default: Undefined


prefixHeaders : pathList

A list of files to automatically include at the beginning of each source file in the product.

Default: Undefined

This property was introduced in Qbs 1.0.1.


requireAppContainer : bool

This property is specific to Windows.

Whether the generated executable or dynamic-link library requires an AppContainer execution environment. Set to true when creating Universal Windows Platform applications.

Default: Undefined

This property was introduced in Qbs 1.10.


requireAppExtensionSafeApi : bool

This property is specific to Apple platforms.

Whether to enforce the use of only app-extension-safe APIs on Apple platforms. This is necessary for building Application Extensions in OS X Yosemite and iOS 8 and above.

If left undefined, uses the compiler and linker defaults (probably false).

Default: Undefined

This property was introduced in Qbs 1.4.


rpathOrigin : string

This property is specific to Unix platforms.

A placeholder value used in an rpath string to refer to the directory containing the referring executable or shared library.

Default: "@loader_path" on Mach-O based platforms (macOS, iOS, tvOS, watchOS); "$ORIGIN" on ELF based platforms (Linux and most other Unix-like platforms).

This property was introduced in Qbs 1.11.


rpaths : stringList

This property is specific to Unix platforms.

A list of rpaths that are passed to the linker. Paths that also appear in systemRunPaths are ignored.

Default: Undefined


runtimeLibrary : string

The type of the runtime library used.

Accepted values are "static" and "dynamic".

If this property is set to undefined, the default runtime library of the toolchain is used.

Note: This property is only functional for MSVC.

Default: "dynamic" for MSVC, undefined for other compilers.

This property was introduced in Qbs 1.3.3.


separateDebugInformation : bool

Whether to store debug information in an external file or bundle instead of within the binary.

The type of files that will be generated when this property is true is dependent on the compiler and target platform:

  • With MSVC, this property controls the generation of .pdb (Program Debug Database) files.
  • On Apple platforms with GCC or Clang, this property controls the generation of .dSYM (DWARF Symbol) bundles or, if dsymutilFlags contains the -f or --flat flags, .dwarf symbol files.
  • On other platforms with GCC or Clang (including Windows/MinGW), this property controls the generation of .debug symbol files.

Default: true for MSVC and with GCC or Clang on Apple platforms, otherwise false.

This property was introduced in Qbs 1.4.


soVersion : string

This property is specific to Unix platforms.

The version number to be appended to the soname in ELF shared libraries.

Default: The major part of product.version if a version is set, otherwise [].

This property was introduced in Qbs 1.7.


sonamePrefix : string

This property is specific to Unix platforms.

A library name or full library path.

If defined, the value of this property is used as a path to be prepended to the built shared library's SONAME identifier. The SONAME (LC_ID_DYLIB on Apple platforms, DT_SONAME on other Unix-like platforms) is the identifier that the dynamic linker will later use to reference the library.

On Apple platforms, the path may contain the following placeholders:

  • @rpath - Expands to paths defined by LC_RPATH Mach-O commands in the current process executable or the referring libraries.
  • @executable_path - Expands to the current process executable location.
  • @loader_path - Expands to the referring executable or library location.

In most cases, using @rpath is sufficient and recommended. However, the prefix may be also specified using different placeholders, or an absolute path.

For more information, see the DYLD documentation on dynamic library install names.

Default: Undefined

This property was introduced in Qbs 1.5.


staticLibraries : stringList

A list of static libraries to be linked.

If the library is part of your project, consider using a Depends item instead.

Default: Undefined


stripName : string

This property is specific to Unix platforms.

The name of the strip binary. This property is set in the build profile.

Default: "strip"

This property was introduced in Qbs 1.4.


stripPath : string

This property is specific to Unix platforms.

The full path of the strip binary. This property is set in the build profile.

Default: Determined by qbs setup-toolchains.

This property was introduced in Qbs 1.4.


systemFrameworkPaths : pathList

This property is specific to Apple platforms.

A list of framework search paths.

Relative paths are considered to be relative to the .qbs product file they are used in. Header files in frameworks in those paths will not cause warnings.

Default: Undefined


systemIncludePaths : pathList

A list of include paths that are passed as system include paths to the compiler.

For header files in those paths, warnings will be ignored.

Relative paths are considered to be relative to the .qbs product file they are used in.

Default: Undefined


systemRunPaths : stringList

The paths the dynamic linker uses on process start-up to locate dynamic libraries.

Default: Auto-detected for host builds on Linux via ldconfig, ["/lib", "/usr/lib"] otherwise on Unix, [] on Windows.

This property was introduced in Qbs 1.6.


treatSystemHeadersAsDependencies : bool

Whether included header files found via systemIncludePaths, distributionIncludePaths, or compilerIncludePaths will be added to the dependencies of the respective object file.

This means that modification of such header files (or any of the headers they include) will cause recompilation.

Default: false

This property was introduced in Qbs 1.8.


treatWarningsAsErrors : bool

Whether warnings will be handled as errors and cause the build to fail.

Default: false


useCPrecompiledHeader : bool

Whether to use a precompiled header for compiling C sources if one is present.

Set this property to false in a Group item to disable precompiled headers for some sources even though a precompiled header is present in the product.

See Relevant File Tags for the associated file tags.

Default: true

This property was introduced in Qbs 1.5.


useCxxPrecompiledHeader : bool

Like useCPrecompiledHeader, but for C++.

Default: true

This property was introduced in Qbs 1.5.


useLanguageVersionFallback : bool

Whether to explicitly use the language standard version fallback values in compiler command line invocations.

By default, Qbs will automatically substitute fallback values for the C and C++ language standard versions specified by the cLanguageVersion and cxxLanguageVersion properties, which are passed to the -std= compiler command line option with GNU-compatible toolchains, if it detects that you are using an older toolchain which does not support the standard values. The substitutions are made as follows:

ValueSubstitute
c++11c++0x
c11c1x
c++14c++1y
c++17c++1z

If this property is explicitly set to true, Qbs will always use the fallback values.

If this property is explicitly set to false, Qbs will never use the fallback values.

This property has no effect with the Microsoft Visual C++ compiler.

Default: Undefined

This property was introduced in Qbs 1.11.


useObjcPrecompiledHeader : bool

Like useCPrecompiledHeader, but for Objective-C.

Default: true

This property was introduced in Qbs 1.5.


useObjcxxPrecompiledHeader : bool

Like useCPrecompiledHeader, but for Objective-C++.

Default: true

This property was introduced in Qbs 1.5.


This property is specific to Unix platforms.

Whether to use the -rpath-link linker option for transitive shared objects.

Default: true on non-Darwin Unix platforms or when targeting macOS 10.4.x and older.

This property was introduced in Qbs 1.8.


useRPaths : bool

This property is specific to Unix platforms.

If false, prevents the linker from writing rpaths to the binary.

Default: true

This property was introduced in Qbs 1.3.


variantSuffix : string

A suffix to add to a product's target name if that product is of the type staticlibrary or dynamiclibrary.

On Darwin platforms, applications and loadable modules are also affected.

By default, this property is left empty on all platforms unless the product is multiplexed over the qbs.buildVariants property. In that case, for the debug variant of the product, the default value is "d" on Windows and "_debug" on Darwin platforms, such as macOS. On all other platforms and in release mode, the default value is [].

For example, building a dynamic library called MyLib that is multiplexed over the qbs.buildVariants property with MSVC will produce files called MyLib.dll (for the release version of the product) and MyLibd.dll (for the debug version).

Default: Platform-specific.

This property was introduced in Qbs 1.10.


visibility : string

This property is specific to Unix platforms.

The visibility level for exported symbols.

Possible values include: "default", "hidden", "hiddenInlines", and "minimal", which combines "hidden" and "hiddenInlines".

Default: "default"


warningLevel : string

The warning level for the compiler: "none" or "all".

Default: "all"


weakFrameworks : stringList

This property is specific to Apple platforms.

A list of frameworks to be weakly linked.

If the framework is part of your project, consider using a Depends item instead.

Default: Undefined


windowsApiAdditionalPartitions : stringList

This property is specific to Windows.

A list of additional Windows API partitions to enable in addition to the ones implicitly enabled by the value of windowsApiFamily (WINAPI_FAMILY).

This value is used when building Windows Store applications. For example, setting windowsApiFamily to "pc" and this property to ["phone"] will allow you to create Windows Store applications that target all Universal Windows Platform device families ("Universal" apps).

Possible values include: "app", "desktop", "pc", "phone", "server", and "system", which are mapped to the corresponding set of possible WINAPI_PARTITION_* preprocessor defines in the Windows SDK.

Default: Undefined, which lets the Windows SDK headers determine the default partitions based on the value of WINAPI_FAMILY.

This property was introduced in Qbs 1.10.

See also windowsApiFamily.


windowsApiCharacterSet : string

This property is specific to Windows.

The character set used in the Win32 API.

The value "unicode" defines the preprocessor symbols UNICODE and _UNICODE, "mbcs" defines _MBCS, and setting the value to undefined will use the default character set.

Default: "unicode"

This property was introduced in Qbs 1.0.1.


windowsApiFamily : string

This property is specific to Windows.

The Windows API family that the application or library is targeting.

This value is used when building Universal Windows Platform applications.

Possible values include: "desktop", "pc", "phone", "server", and "system", which are mapped to the corresponding set of possible values for the WINAPI_FAMILY preprocessor define in the Windows SDK.

Default: Undefined, which lets the Windows SDK headers determine the default.

This property was introduced in Qbs 1.10.


© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.