cpp
Provides C/C++ support. More...
Since: | Qbs 1.0 |
Properties
- allowUnresolvedSymbols : bool
- alwaysUseLipo : bool
- architecture : string
- archiverName : string
- archiverPath : string
- assemblerFlags : stringList
- assemblerListingSuffix : string
- assemblerName : string
- assemblerPath : string
- automaticReferenceCounting : bool
- cFlags : stringList
- cLanguageVersion : stringList
- combineCSources : bool
- combineCxxSources : bool
- combineObjcSources : bool
- combineObjcxxSources : bool
- commonCompilerFlags : stringList
- compilerDefinesByLanguage : var
- compilerFrameworkPaths : pathList
- compilerIncludePaths : pathList
- compilerLibraryPaths : pathList
- compilerListingSuffix : string
- compilerName : string
- compilerPath : string
- compilerPathByLanguage : var
- compilerVersion : string
- compilerVersionMajor : int
- compilerVersionMinor : int
- compilerVersionPatch : int
- compilerWrapper : stringList
- cppFlags : stringList
- createSymlinks : bool
- cxxFlags : stringList
- cxxLanguageVersion : stringList
- cxxStandardLibrary : string
- debugInfoBundleSuffix : string
- debugInfoSuffix : string
- debugInformation : bool
- defines : stringList
- discardUnusedData : bool
- distributionFrameworkPaths : pathList
- distributionIncludePaths : pathList
- distributionLibraryPaths : pathList
- driverFlags : stringList
- driverLinkerFlags : stringList
- dsymutilFlags : stringList
- dsymutilPath : string
- dynamicLibraries : stringList
- dynamicLibraryImportSuffix : string
- dynamicLibraryPrefix : string
- dynamicLibrarySuffix : string
- enableCompilerDefinesByLanguage : stringList
- enableCxxLanguageMacro : string
- enableExceptions : bool
- enableReproducibleBuilds : bool
- enableRtti : bool
- enableSuspiciousLinkerFlagWarnings : bool
- endianness : string
- entryPoint : string
- exceptionHandlingModel : string
- executablePrefix : string
- executableSuffix : string
- exportedSymbolsCheckMode : string
- forceUseCxxModules : bool
- frameworkPaths : pathList
- frameworks : stringList
- generateAssemblerListingFiles : bool
- generateCompilerListingFiles : bool
- generateLinkerMapFile : bool
- generateManifestFile : bool
- importPrivateLibraries : string
- includePaths : pathList
- libraryPaths : pathList
- linkerFlags : stringList
- linkerMapSuffix : string
- linkerMode : string
- linkerName : string
- linkerPath : string
- linkerVariant : string
- linkerWrapper : stringList
- lipoPath : string
- loadableModulePrefix : string
- loadableModuleSuffix : string
- minimumIosVersion : string
- minimumMacosVersion : string
- minimumTvosVersion : string
- minimumWatchosVersion : string
- minimumWindowsVersion : string
- nmName : string
- nmPath : string
- objcFlags : stringList
- objcopyName : string
- objcopyPath : string
- objcxxFlags : stringList
- objectSuffix : string
- optimization : string
- platformDefines : stringList
- positionIndependentCode : bool
- prefixHeaders : pathList
- removeDuplicateLibraries : bool
- requireAppContainer : bool
- requireAppExtensionSafeApi : bool
- rpathLinkFlag : string
- rpathOrigin : string
- rpaths : stringList
- runtimeLibrary : string
- separateDebugInformation : bool
- soVersion : string
- sonamePrefix : string
- staticLibraries : stringList
- staticLibraryPrefix : string
- staticLibrarySuffix : string
- stripName : string
- stripPath : string
- systemFrameworkPaths : pathList
- systemIncludePaths : pathList
- systemRunPaths : stringList
- toolchainInstallPath : string
- treatSystemHeadersAsDependencies : bool
- treatWarningsAsErrors : bool
- useCPrecompiledHeader : bool
- useCxxPrecompiledHeader : bool
- useLanguageVersionFallback : bool
- useObjcPrecompiledHeader : bool
- useObjcxxPrecompiledHeader : bool
- useRPathLink : bool
- useRPaths : bool
- variantSuffix : string
- visibility : string
- warningLevel : string
- weakFrameworks : stringList
- windowsApiAdditionalPartitions : stringList
- windowsApiCharacterSet : string
- windowsApiFamily : string
- windowsSdkVersion : string
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
Parameter | Type | Since | Default | Description |
---|---|---|---|---|
link | bool | 1.9 | undefined | If false , the dependency will not be linked, even if it is a valid input for a linker rule. This property affects library dependencies only. |
linkWholeArchive | bool | 1.9 | undefined | If 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. |
symbolLinkMode | string | 1.9 | undefined | Attribute 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. Note that "lazy" mode is deprecated and doesn't work with Xcode 15 and above. |
Relevant File Tags
Tag | Auto-tagged File Names | Since | Description |
---|---|---|---|
"application" | n/a | 1.0.1 | The 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.0 | Source 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 , *.sx | 1.1.0 | Like "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.1 | Source 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.8 | Source 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.1 | Source 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.8 | Source 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.5 | Files 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. |
"def" | - | 1.17.0 | This tag is used for a module-definition file (.def) to be passed to the linker. Such a file provides the linker with information about exports, attributes, and other information about the program to be linked. This file tag only has an effect with the MSVC toolchain. |
"dynamiclibrary" | n/a | 1.0.1 | The rule that creates dynamic libraries (typically via a linker) attaches this tag to its output artifact. |
"dynamiclibrary_import" | n/a | 1.0.0 | This tag is used for import libraries of dynamic libraries. For example, the MSVC linker rule creates a dynamiclibrary_import artifact foo.lib in addition to a dynamiclibrary artifact foo.dll . |
"hpp" | *.h , *.H , *.hpp , *.hxx , *.h++ | 1.0.1 | This 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.0 | This 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/a | 1.0.1 | The 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.0 | Source 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.8 | Source 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.0 | Source 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.8 | Source files with this tag serve as inputs to a rule combining them into a single Objective-C++ file, which will then be compiled. |
"rc" | *.rc | 1.1.0 | Files 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/a | 1.0.1 | The rule that creates static libraries (typically via a linker) attaches this tag to its output artifact. |
"versionscript" | - | 1.5.0 | This 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. |
Relevant Job Pools
Pool | Since | Description |
---|---|---|
"assembler" | 1.13 | The job pool used by rules that run the toolchain's assembler. This is only relevant for direct invocations of the assembler binary, not for running it indirectly via the compiler. |
"compiler" | 1.13 | The job pool used by rules that run a compiler. All language variants use the same pool. |
"linker" | 1.13 | The job pool used by rules that run a linker. |
Property Documentation
[since Qbs 1.2] 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.
[since Qbs 1.9] 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.
[since Qbs 1.5] assemblerFlags : stringList |
A list of additional flags for the assembler.
Default: Undefined
This property was introduced in Qbs 1.5.
assemblerListingSuffix : string |
A string to append to the generated assembler listing files.
Default: toolchain-dependent, typical value is ".lst"
[since 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.
[since 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.
[since Qbs 1.4] 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
[since Qbs 1.4] 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"
, "c17"
, "c2x"
.
Default: Undefined
This property was introduced in Qbs 1.4.
[since Qbs 1.8] 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.
[since 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.
[since Qbs 1.8] 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.
[since Qbs 1.8] 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.
[since Qbs 1.0.1] 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.
[since Qbs 1.10] 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.
[since Qbs 1.6] 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.
[since 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.
[since 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.
compilerListingSuffix : string |
A string to append to the generated compiler listing files.
Default: toolchain-dependent, typical value is ".lst"
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.
[since Qbs 1.3] 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.
compilerVersion : string |
Compiler version string consisting of major, minor and patch numbers, separated by a dot.
Default: Undefined
[since Qbs 1.4] compilerVersionMajor : int |
The major version of the compiler.
Default: Undefined
This property was introduced in Qbs 1.4.
[since Qbs 1.4] compilerVersionMinor : int |
The minor version of the compiler.
Default: Undefined
This property was introduced in Qbs 1.4.
[since Qbs 1.4] compilerVersionPatch : int |
The patch level component of the compiler version.
Default: Undefined
This property was introduced in Qbs 1.4.
[since Qbs 1.1] 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
createSymlinks : bool |
This property is specific to Unix platforms.
Whether to create version alias symlinks when building a dynamic library.
Default: true
cxxFlags : stringList |
A list of additional flags for the C++ compiler.
Default: Undefined
[since Qbs 1.4] 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"
, "c++20"
, "c++23"
.
Default: Undefined
This property was introduced in Qbs 1.4.
[since 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.
debugInfoBundleSuffix : string |
This property is specific to Apple platforms.
A string to append to the debug information bundle name.
Default: ".dSYM"
debugInfoSuffix : string |
A string to append to the debug information file name.
Default: toolchain-dependent, typical values are ".debug"
, ".pdb"
or ".dwarf"
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
[since Qbs 1.10] 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.
[since Qbs 1.8] 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.
[since 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.
[since 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.
[since Qbs 1.6] 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.
[since Qbs 1.11] 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.
[since Qbs 1.4.1] 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.
[since Qbs 1.4] 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.
Each library can be specified in one of two ways:
- An absolute file path (for example,
"/foo/bar.lib"
), in which case it is passed directly to the linker, ignoring libraryPaths. - A library basename (for example,
"bar"
), in which case the directory that contains the library must be provided via libraryPaths.
Relative paths ("foo/bar.lib"
) are not allowed.
Default: Undefined
See also libraryPaths and How do I create a module for a third-party library?.
dynamicLibraryImportSuffix : string |
This property is specific to Windows.
A string to append to the dynamic library import file name.
Default: ".lib"
dynamicLibraryPrefix : string |
dynamicLibrarySuffix : string |
[since Qbs 1.10] 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.
[since Qbs 1.20] enableCxxLanguageMacro : string |
Whether to set the /Zc:__cplusplus
macro (https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus)
This property only applies to MSVC toolchain. clang-cl also supports this option, but it has no effect.
This property is specific to Windows. Default: true
for MSVC, false
for clang-cl
This property was introduced in Qbs 1.20.
[since Qbs 1.5] enableExceptions : bool |
Whether to enable exceptions in C++ code.
Default: true
This property was introduced in Qbs 1.5.
[since 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.
[since Qbs 1.5] enableRtti : bool |
Whether to enable runtime type information in C++ code.
Default: Undefined
This property was introduced in Qbs 1.5.
[since Qbs 1.8] enableSuspiciousLinkerFlagWarnings : bool |
Whether to print warnings about escaped linker flags (such as -Xlinker
and -Wl
).
Default: true
This property was introduced in Qbs 1.8.
[since Qbs 1.9] 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.
[since Qbs 1.3] 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.
[since Qbs 1.5] 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.
executablePrefix : string |
A string to prepend to the executable file name.
Default: ""
executableSuffix : string |
[since Qbs 1.4.1] 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.
[since Qbs 2.5] forceUseCxxModules : bool |
Set this property to true
to force support for C++20 Modules.
On details how to use modules, see the corresponding section in the tutorial.
By default, modules support is disabled since this feature is considered experimental.
Note: The default value is subject to change.
Default: false
This property was introduced in Qbs 2.5.
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
[since Qbs 1.15] generateAssemblerListingFiles : bool |
This property is specific to bare-metal platforms.
Whether to auto-generate an assembler listing files.
Default: false
This property was introduced in Qbs 1.15.
[since Qbs 1.15] generateCompilerListingFiles : bool |
Whether to auto-generate compiler listing files.
Default: false
This property was introduced in Qbs 1.15.
[since Qbs 1.13] generateLinkerMapFile : bool |
Whether to auto-generate a linker map file.
Default: false
This property was introduced in Qbs 1.13.
[since Qbs 1.5.0] 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.
[since Qbs 2.4] importPrivateLibraries : string |
Whether to automatically import external libraries from dependencies.
If set to true in the product that depends on the static library, the external dependencies (such as staticLibraries and dynamicLibraries) of this library are also added to products that depend on this library.
StaticLibrary { files: "lib.cpp" cpp.staticLibraries: ["l", "y"] }
If set to false, the explicit Export item is required:
StaticLibrary { files: "lib.cpp" Export { Depends { name: "cpp" } cpp.staticLibraries: ["l", "y"] } }
We recommend using the Export item as it provides more flexibility.
Note: The default value is subject to change.
Default: true
This property was introduced in Qbs 2.4.
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.
The paths will be passed to the linker in the appropriate way. For example, the -L
argument will be used when using ld
-like linkers.
Relative paths are considered to be relative to the .qbs
product file they are used in.
Default: Undefined
See also dynamicLibraries and How do I create a module for a third-party library?.
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.
linkerMapSuffix : string |
A string to append to the generated linker memory map files.
Default: toolchain-dependent, typical value is ".map"
[since Qbs 1.6] linkerMode : string |
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.
[since Qbs 1.1.1] 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.
[since 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.
[since Qbs 1.13] linkerVariant : string |
Set this property to force the use of a specific linker. A non-empty value will result in the -fuse-ld
option being emitted when linking with gcc
, clang
or clang-cl
. Other toolchains do not support this property.
The possible values for clang
and gcc
are "bfd"
, "gold"
, "lld"
and "mold"
, the possible values for clang-cl
are "link"
and "lld"
.
The following example demonstrates how to change the linker for different toolchains:
Properties { condition: qbs.toolchain.includes("gcc") cpp.linkerVariant: "gold" } Properties { condition: qbs.toolchain.includes("clang-cl") cpp.linkerVariant: "lld" }
Default: Undefined
This property was introduced in Qbs 1.13.
[since Qbs 1.6.2] 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.
[since Qbs 1.9] 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.
loadableModulePrefix : string |
This property is specific to Apple platforms.
A string to prepend to the Darwin loadable module file name.
Default: ""
loadableModuleSuffix : string |
This property is specific to Apple platforms.
A string to append to the Darwin loadable module file name.
Default: ".bundle"
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 set to undefined, compiler defaults will be used.
Note: Qbs sets minimum version to "6.0"
for armv7a
because earlier iOS versions are broken in recent XCode installations.
Default: "6.0"
for armv7a
, undefined
otherwise
[since Qbs 1.5.2] 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.
[since Qbs 1.5] 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.
Note: Qbs sets the minimum version to "6.0"
, because earlier tvOS versions are not supported by recent XCode installations by default.
Default: "6.0
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
[since Qbs 1.2] 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.
[since 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
[since Qbs 1.4] 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.
[since 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
objectSuffix : string |
A string to append to the generated object files.
Default: toolchain-dependent, typical values are ".o"
or ".obj"
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
[since Qbs 1.0.1] 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.
[since Qbs 1.16] removeDuplicateLibraries : bool |
Whether the list of the objects and libraries is reduced to a list of unique values before being passed to the linker.
Default: true
This property was introduced in Qbs 1.16.
[since Qbs 1.10] 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.
[since Qbs 1.4] 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.
[since Qbs 1.9] rpathLinkFlag : string |
The rpath link flag used by the linker.
Default: toolchain-dependent, typical values are "-rpath-link="
or "-L"
This property was introduced in Qbs 1.9.
[since Qbs 1.11] 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
See also How do I make use of rpaths?.
[since Qbs 1.3.3] 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 and MinGW.
Default: "dynamic"
for MSVC and MinGW, undefined
for other compilers.
This property was introduced in Qbs 1.3.3.
[since Qbs 1.4] 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.
See also debugInformation and How do I separate and install debugging symbols?.
[since Qbs 1.7] 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.
[since Qbs 1.5] 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 byLC_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.
See also How do I make use of rpaths?.
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
staticLibraryPrefix : string |
staticLibrarySuffix : string |
[since Qbs 1.4] 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.
[since 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
[since Qbs 1.6] 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.
toolchainInstallPath : string |
The directory path where the toolchain is installed. This property is set in the build profile.
This is usually the base property from which all compiler and tool paths are automatically derived.
Default: Determined by qbs setup-toolchains.
[since Qbs 1.8] 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
[since Qbs 1.5] 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.
[since Qbs 1.5] useCxxPrecompiledHeader : bool |
[since Qbs 1.11] 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:
Value | Substitute |
---|---|
c++11 | c++0x |
c11 | c1x |
c++14 | c++1y |
c++17 | c++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.
[since Qbs 1.5] useObjcPrecompiledHeader : bool |
Like useCPrecompiledHeader, but for Objective-C.
Default: true
This property was introduced in Qbs 1.5.
[since Qbs 1.5] useObjcxxPrecompiledHeader : bool |
Like useCPrecompiledHeader, but for Objective-C++.
Default: true
This property was introduced in Qbs 1.5.
[since Qbs 1.8] useRPathLink : bool |
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.
[since Qbs 1.3] 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.
[since Qbs 1.10] 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
[since Qbs 1.10] 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.
[since Qbs 1.0.1] 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.
[since Qbs 1.10] 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.
[since Qbs 1.19] windowsSdkVersion : string |
Which Windows SDK version should be used with MSVC toolchain. By default, the latest SDK is used.
This property is specific to Windows. Default: Undefined
This property was introduced in Qbs 1.19.
© 2022 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.