---
url: /examples/configuration/custom_toolchain.md
---

# Custom Toolchain

We can use `toolchain()` to define custom toolchains to support special compilers or cross-compilation environments.

For details on custom toolchain configuration, see: [Custom Toolchain API](/api/description/custom-toolchain).

For a detailed tutorial, see [Toolchain Configuration Guide](/guide/project-configuration/toolchain-configuration) and [Switch Toolchains](/guide/basic-commands/switch-toolchains).

## Basic Example

### Build and Run

```bash
$ xmake
$ xmake run
```

## Unknown Toolchain

If we need to support a completely unknown compiler toolchain, we need to implement the detection script of the toolchain, as well as the script configuration of all tool sets such as compilation, linking, archiving, etc.
