Module cpp
The cpp
module contains the properties and rules for toolchains of the C/C++ family. On OS X this includes support for Objective-C/C++.
General Properties
Property | Type | Since | Default | Description |
---|---|---|---|---|
allowUnresolvedSymbols | bool | 1.2 | false | Switch this on 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. |
architecture | string | 1.0 | qbs.architecture | Target architecture. See qbs.architecture . |
debugInformation | bool | 1.0 | qbs.debugInformation | Generate debug information. See qbs.debugInformation . |
separateDebugInformation | bool | 1.4 | false for gcc/clang, true for MSVC | Whether to store debug information in an external file or bundle instead of within the binary. |
defines | stringList | 1.0 | undefined | 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"'] |
platformDefines | stringList | 1.0 | undefined | 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. |
compilerDefines | stringList | 1.0 | undefined | 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. |
includePaths | pathList | 1.0 | undefined | List of include paths. Relative paths are considered to be relative to the .qbs product file they are used in. |
systemIncludePaths | pathList | 1.0 | undefined | 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. |
libraryPaths | pathList | 1.0 | undefined | List of library search paths. Relative paths are considered to be relative to the .qbs product file they are used in. |
dynamicLibraries | stringList | 1.0 | undefined | List of dynamic libraries to be linked. If the library is part of your project, consider using a Depends item instead. |
staticLibraries | stringList | 1.0 | undefined | List of static libraries to be linked. If the library is part of your project, consider using a Depends item instead. |
prefixHeaders | pathList | 1.0.1 | undefined | List of files to automatically include at the beginning of each source file in the product. |
precompiledHeader | path | 1.0 | undefined | Name of the header file to be precompiled. If you want to use the same precompiled header for all languages (C, C++, Objective-C and Objective-C++), set this property and ensure that the header contains appropriate ifdefs. Otherwise, use the |
cPrecompiledHeader | path | 1.1 | precompiledHeader | Name of the C header file to be precompiled. |
cxxPrecompiledHeader | path | 1.1 | precompiledHeader | Name of the C++ header file to be precompiled. |
objcPrecompiledHeader | path | 1.1 | precompiledHeader | Name of the Objective-C header file to be precompiled. |
objcxxPrecompiledHeader | path | 1.1 | precompiledHeader | Name of the Objective-C++ header file to be precompiled. |
precompiledHeaderDir | path | 1.0 | product.buildDirectory | The directory that will contain the precompiled header files. Usually you won't need to set this. |
optimization | string | 1.0 | qbs.optimization | Optimization level. See qbs.optimization . |
treatWarningsAsErrors | bool | 1.0 | false | Warnings will be handled as errors and cause the build to fail. |
warningLevel | string | 1.0 | "all" | Specifies the warning level for the compiler - "none" or "all" . |
commonCompilerFlags | stringList | 1.0.1 | undefined | Flags that are added to all compilation commands independently of the language. |
compilerVersionMajor | int | 1.4 | undefined | The major version of the compiler. |
compilerVersionMinor | int | 1.4 | undefined | The minor version of the compiler. |
compilerVersionPatch | int | 1.4 | undefined | The patch level component of the compiler version. |
cppFlags | stringList | 1.0 | undefined | Additional flags for the C preprocessor. |
cFlags | stringList | 1.0 | undefined | Additional flags for the C compiler. |
cxxFlags | stringList | 1.0 | undefined | Additional flags for the C++ compiler. |
cLanguageVersion | string | 1.4 | undefined | The version of the C standard with which the code must comply. If this property is set, corresponding compiler and/or linker flags will be added, depending on the toolchain. If the value is left undefined, the compiler default will be used. Possible values include: "c89" , "c99" , "c11" |
cxxLanguageVersion | string | 1.4 | undefined | The version of the C++ standard with which the code must comply. If this property is set, corresponding compiler and/or linker flags will be added, depending on the toolchain. If the value is left undefined, the compiler default will be used. Possible values include: "c++98" , "c++11" , "c++14" |
cxxStandardLibrary | string | 1.4 | undefined | The C++ standard library to link to. If this property is set, corresponding compiler and/or 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++" |
objcFlags | stringList | 1.0 | undefined | Additional flags for the Objective-C compiler. |
objcxxFlags | stringList | 1.0 | undefined | Additional flags for the Objective-C++ compiler. |
linkerFlags | stringList | 1.0 | undefined | Additional flags for the linker. |
linkerScripts | pathList | 1.2 | undefined | List of linker script files. |
compilerName | string | 1.0 | determined by qbs-setup-toolchains | Name of the main compiler binary. This is set in the build profile. |
compilerPath | string | 1.0 | determined by qbs-setup-toolchains | Full path of the main compiler binary. This is set in the build profile. If the toolchain provides different compilers for different languages, then compilerPathByLanguage is used. |
compilerPathByLanguage | string to string map | 1.3 | determined by qbs-setup-toolchains | Maps file tags to full paths of compiler binaries. This is set in the build profile. |
compilerWrapper | stringList | 1.1 | undefined | Wrapper binary and its arguments for wrapping compiler calls. This is useful for compiler wrappers like ccache and alike. |
linkerName | string | 1.1.1 | determined by qbs-setup-toolchains | Name of the linker binary. This is set in the build profile. |
linkerPath | string | 1.1.1 | determined by qbs-setup-toolchains | Full path of the linker binary. This is set in the build profile. |
entryPoint | string | 1.3 | undefined | Name of the entry point of an executable or dynamic library. If this property is undefined, the toolchain's default is used. |
runtimeLibrary | string | 1.3.3 | "dynamic" for MSVC, undefined for others | Type of the used runtime library. Accepted values are "static" and "dynamic" . If this property is set to undefined , then the default runtime library of the toolchain is used.Note: For MSVC the default value is Note: At the moment this property is only functional for MSVC. |
Properties Specific to Apple Platforms
Property | Type | Since | Default | Description |
---|---|---|---|---|
frameworkPaths | pathList | 1.0 | undefined | List of framework search paths. Relative paths are considered to be relative to the .qbs product file they are used in. |
systemFrameworkPaths | pathList | 1.0 | undefined | 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. |
frameworks | stringList | 1.0 | undefined | List of frameworks to be linked. If the framework is part of your project, consider using a Depends item instead. |
weakFrameworks | stringList | 1.0 | undefined | List of frameworks to be weakly linked. If the framework is part of your project, consider using a Depends item instead. |
installNamePrefix | string | 1.0 | undefined | The prefix for the internal install name (LC_ID_DYLIB) of a dynamic library on Darwin (OS X and iOS). Typically this should be set to "@rpath" on modern platforms that support it, which includes OS X 10.5 and above, and all versions of iOS. |
automaticReferenceCounting | bool | 1.4 | undefined | Whether to enable Automatic Reference Counting (ARC) for Objective-C and Objective-C++ source code. If undefined , uses the compiler default (probably false ). |
requireAppExtensionSafeApi | bool | 1.4 | undefined | Whether to enforce the use of only app-extension-safe APIs on OS X and iOS. This is necessary for building Application Extensions in OS X Yosemite and iOS 8 and above. If undefined , uses the compiler and linker defaults (probably false ). |
minimumIosVersion | string | 1.0 | undefined, but may be set by generated profiles | 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 undefined, compiler defaults will be used. |
minimumOsxVersion | string | 1.0.1 | undefined, but may be set by generated profiles | A version number in the format [major].[minor] indicating the earliest version of OS X that the product should run on. Passes -mmacosx-version-min=<version> to the compiler. If undefined, compiler defaults will be used. |
Properties Specific to Unix Platforms
Property | Type | Since | Default | Description |
---|---|---|---|---|
archiverName | string | 1.0 | "ar" | Name of the archiver binary. This is set in the build profile. |
archiverPath | string | 1.0 | determined by qbs-setup-toolchains | Full path of the archiver binary. This is set in the build profile. |
exportedSymbolsCheckMode | string | 1.4.1 | "ignore-undefined" | 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" , then this property can be set to "strict" . |
nmName | string | 1.2 | "nm" | Name of the nm binary. This is set in the build profile. |
nmPath | string | 1.2 | determined by qbs-setup-toolchains | Full path of the nm binary. This is set in the build profile. |
objcopyName | string | 1.4 | "objcopy" | Name of the objcopy binary. This is set in the build profile. |
objcopyPath | string | 1.4 | determined by qbs-setup-toolchains | Full path of the objcopy binary. This is set in the build profile. |
stripName | string | 1.4 | "strip" | Name of the strip binary. This is set in the build profile. |
stripPath | string | 1.4 | determined by qbs-setup-toolchains | Full path of the strip binary. This is set in the build profile. |
dsymutilPath | string | 1.4 | determined by qbs-setup-toolchains | Full path of the dsymutil binary. This is set in the build profile. |
dsymutilFlags | stringList | 1.4.1 | undefined | Additional flags for the dsymutil tool. |
positionIndependentCode | bool | 1.0 | undefined | Generate position independent code. If this property is undefined , then position independent code is generated for libraries, but not for applications. |
rpaths | stringList | 1.0 | undefined | List of rpaths that are passed to the linker. |
useRPaths | bool | 1.3 | true | Set this property to false to prevent the linker from writing rpaths to the binary. |
visibility | string | 1.0 | "default" | Visibility level for exported symbols. Possible values include: "default" , "hidden" , "hiddenInlines" , and "minimal" , which combines "hidden" and "hiddenInlines" . |
Properties Specific to Windows
Property | Type | Since | Default | Description |
---|---|---|---|---|
windowsApiCharacterSet | string | 1.0.1 | "unicode" | Specifies the character set used in the Win32 API. "unicode" will define the preprocessor symbols UNICODE and _UNICODE, "mbcs" will define _MBCS, and setting the value to undefined will use the default character set. |
minimumWindowsVersion | string | 1.0 | undefined, but may be set by generated profiles | 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 -Wl,--major-subsystem-version, -Wl,--minor-subsystem-version, -Wl,--major-os-version and -Wl,--minor-os-version for MinGW. If undefined, compiler defaults will be used. |