- Qbs Manual
- setup-toolchains
- Qbs 1.24.0

# setup-toolchains

## Synopsis

     qbs setup-toolchains [--settings-dir <directory>] [--system] --detect
     qbs setup-toolchains [--settings-dir <directory>] [--system] [--type <toolchain type>]
                          <compiler path> <profile name>

## Description

The first form tries to auto-detect all known toolchains, looking them up via the PATH variable.

The second form creates a profile with the name `<profile name>` for the toolchain located at `<compiler path>`. It will attempt to determine the toolchain type automatically based on the file name or the compiler executable. If that fails, you need to provide the compiler type as a value of the `--type` option.

For more information, see Configuring Profiles and Preferences.

## Options

### `--settings-dir <directory>`

Reads all settings (such as profile information) from the specified `<directory>`. If the directory does not exist, it will be created.

The default value is system-specific. For example:

- Linux: `$HOME/.config/QtProject/qbs`
- Windows: `%APPDATA%\QtProject\qbs`
- macOS: `$HOME/Library/Preferences/qbs`

### `--system`

If this option is given, the profile(s) created by this tool will end up in the system-level settings and thus be available to all users. Otherwise, they go into the user-level settings.

### `--detect`

Attempts to auto-detect all known toolchains, looking them up in the PATH environment variable.

### `--type <toolchain type>`

Specifies the type of the toolchain. Needed if Qbs cannot determine the compiler from the name of the executable file located in the specified directory.

Possible values include:

- `clang`
- `gcc`
- `mingw`
- `msvc`
- `iar`
- `keil`
- `sdcc`
- `cosmic`
- `dmc`
- `watcom`

### `--help|-h|-?`

Displays help for the command.

## Examples

Looks up toolchains via the PATH variable and creates profiles for them:

     qbs setup-toolchains --detect

Creates a profile called `mingw` for the toolchain located in `C:\mingw530_32\bin` on Windows:

     qbs setup-toolchains C:\mingw530_32\bin\g++.exe mingw

Creates a profile called `g++-mingw-w64` for the toolchain located in `/usr/bin/x86_64-w64-mingw32-g++` g++-mingw-w64 on Ubuntu:

     qbs setup-toolchains /usr/bin/x86_64-w64-mingw32-g++ g++-mingw-w64