- Qbs Manual
- QbsModuleProviders
- qbspkgconfig
- Qbs 3.1.0

# qbspkgconfig

Module provider based on the qbspkg-config library. More...

Since: | Qt 1.20

- List of all members, including inherited members

## Properties

- definePrefix : bool
- executableFilePath : string
- executableNames : stringList
- extraPaths : stringList
- libDirs : stringList
- staticMode : bool
- sysroot : path

## Detailed Description

Qbs uses a built-in parser of the `*.pc` files and does not require the presence of the `pkg-config` tool in the system. However, if the `pkg-config` tool is present, Qbs will use the same libDirs as the system pkg-config uses by default; otherwise, a built-in list of paths is used.

In order to enable usage of this provider in your Product, set the qbsModuleProviders property as shown in the example below:

     CppApplication {
         consoleApplication: true
         Depends { name: "zlib"; required: false }
         condition: !qbs.toolchain.includes("emscripten") && zlib.present
         name: "PkgConfigProviderExample"
         files: "main.c"
         qbsModuleProviders: ["qbspkgconfig"]
     }

## Property Documentation

definePrefix : bool

If this property is `true`, then Qbs will override the ${prefix} variable in the packages with a value that is guessed based on the location of the .pc file.

This option corresponds to the `--define-prefix` / `--dont-define-prefix` command line options of the `pkg-config` tool.

Default: `true` on Windows, `false` otherwise

executableFilePath : string

The path to the `pkg-config` executable. If not set, the pkg-config from PATH is used.

Default: undefined

executableNames : stringList

The names of the `pkg-config` executable to search for.

Note that since newer distributions use pkgconf by default, it has higher priority over `pkg-config`.

Default: `["pkgconf", "pkg-config"]`

extraPaths : stringList

Set this if you need to add extra search directories.

This property is the equivalent of the `PKG_CONFIG_PATH` variable for the `pkg-config` tool.

Default: Undefined

libDirs : stringList

Set this if you need to overwrite the default search directories.

Note: You do not need to set this for cross-compilation in order to point to the sysroot. Qbs does that for you.

This property is the equivalent of the `PKG_CONFIG_LIBDIR` variable for the `pkg-config` tool.

Default: Undefined

staticMode : bool

If this property is `true`, then Qbs will include "private" libs and dependencies of the package. This property is the equivalent of the `--static` option for the `pkg-config` tool.

Set this if your product is to be linked statically.

Default: `false`

sysroot : path

Set this property if you need to overwrite the default search sysroot path used by `pkg-config`.

This can be useful if `pkg-config` files are located in the directory other than qbs.sysroot. This is the case on macOS platform - all XCode profiles are sysrooted to the SDK directory, but `pkg-config` is typically intalled using Brew and resides in the `/usr/local` directory.

Setting this property to `undefined` or empty (`""`) value will use pkg-config's default search paths:

     qbs resolve moduleProviders.qbspkgconfig.sysroot:undefined

This property is the equivalent of the `PKG_CONFIG_SYSROOT_DIR` variable for the `pkg-config` tool.

Default: `""` on macOS, `qbs.sysroot` on other platforms