# Toolchains

> **TL;DR**
> `Settings | Build, Execution, Deployment | Toolchains`

For [CMake](quick-cmake-tutorial.html), [Makefile](makefiles-support.html), and [compilation database](compilation-database.html) projects in CLion, a toolchain is a set of all the necessary tools required for building and running your application: the CMake executable (CMake projects), the build tool, the C/C++ compilers, the debugger binary, and the working environment.

When you start working with CLion, you already have a default toolchain available. Although you can use it in development, you may also want to adjust the set of tools for the needs of your project (for example, switch to another compiler).

> **Tip:**
> You can have multiple toolchains for one project and switch between them when needed.

Select the kind of project you are working with to learn more:

## CMake projects

CLion uses the configured toolchain to build and run your CMake application. After you set up a toolchain, you can select it in [CMake profile](cmake-profile.html) settings.

## Makefile projects

CLion uses the selected toolchain when loading Makefile projects. The toolchain also provides the debugger for [Native Application](makefiles-support.html#rd-configs) configurations.

After configuring a toolchain, you will be able to select it in `Settings | Build, Execution, Deployment | Makefile`.

See [Makefiles: Adjust project settings](makefiles-support.html#makefile-settings).

## Compilation database projects

CLion uses the selected toolchain for resolving the compilation database project files.

After configuring a toolchain, you will be able to select it in `Settings | Build, Execution, Deployment | Compilation Database`. Note that [Remote](remote-projects-support.html) toolchains are not supported for compilation database projects.

See [Compilation database: Check the toolchain](compilation-database.html#compdb_toolchain).

## Custom build targets and applications

The selected toolchain provides the environment and the debugger for custom run/debug configurations. See [Creating a custom build target](custom-build-targets.html#customtarget-compdb).

Procedure: Create a toolchain

1. Go to `Settings | Build, Execution, Deployment | Toolchains` and click ![](https://resources.jetbrains.com/help/img/idea/2026.2/app.expui.general.add.svg) to add a new toolchain.

Windows:

Watch this video for an overview of Windows toolchain options:

[Video](https://www.youtube.com/v/Vj06cfj6LyI)

Select one of the pre-defined toolchain setups ([MinGW](quick-tutorial-on-configuring-clion-on-windows.html#MinGW), [Cygwin](quick-tutorial-on-configuring-clion-on-windows.html#Cygwin), [Visual Studio](quick-tutorial-on-configuring-clion-on-windows.html#MSVC), or [WSL](quick-tutorial-on-configuring-clion-on-windows.html#WSL)), [Remote Host](remote-projects-support.html#remote-toolchain), [Docker](clion-toolchains-in-docker.html)) or configure a custom toolchain ([System](quick-tutorial-on-configuring-clion-on-windows.html#system)):

![Windows toolchain options](https://resources.jetbrains.com/help/img/idea/2026.2/cl_toolchain_options.png)

> **Tip:**
> * For more information about configuring CLion on Windows, refer to our [tutorial](quick-tutorial-on-configuring-clion-on-windows.html).
>
> * Remote Host toolchains are described in [Remote with local sources](remote-projects-support.html#remote-toolchain). If you are working with a Docker container, refer to [Docker toolchain](docker.html).

macOS/Linux:

On Linux or macOS, choose the type of your toolchain: System for local projects, Remote Host or Docker for [remote development](remote-projects-support.html).

![macOS toolchains](https://resources.jetbrains.com/help/img/idea/2026.2/cl_macos_toolchains.png)

> **Tip:**
> See [Toolchains]() for general information.
>
>
>
>
>
> For more information about Remote Host toolchains, refer to [Remote with local sources](remote-projects-support.html#remote-toolchain). If you are working with a Docker container, refer to [Docker toolchain](docker.html).

2. To initialize the toolchain environment via a script, click Add environment and specify the path to the file. See [below](#env-scripts) for more information.

3. If required, switch from the bundled CMake to a custom CMake installation of your choice.

> **Note:**
> Make sure your custom installation is version 3.15 or newer.

4. By default, CLion will use bundled Ninja as the Build Tool. You can specify another build tool of your choice, for example, make.

5. CLion will attempt to detect the C/C++ compilers.

If you prefer to use custom compilers instead of the detected ones, provide the paths in C Compiler and C++ Compiler. See [Switching compilers](how-to-switch-compilers-in-clion.html).

> **Note:**
> If you are using the GNU ARM toolchain, make sure it's presented in your system `PATH` (refer to [Embedded development: toolchains and compilers](embedded-overview.html#toolchains)).
>
>
>
> For the IAR toolchain, specify the compilers as described in [IAR toolchain](iar-toolchain.html).

6. Select the [Debugger](configuring-debugger-options.html).

On macOS, you can switch between the bundled LLDB (version 21.1.7) and custom GDB.

On Windows, the options include the bundled GDB (version 17.1), custom GDB, and LLDB (version 9.0.0) for [MSVC](quick-tutorial-on-configuring-clion-on-windows.html#MSVC).

Note that custom LLDB is not currently supported.

7. CLion verifies your choices and notifies you if any of the tools or packages are missing.

8. When the configuration is completed, click OK to save it.

## Initializing the toolchain environment via a script

Instead of setting the environment manually, you can point CLion to an environment file — a shell script that initializes the environment for your project. This is helpful, for example, when you need to initialize compiler variables, add custom ones, or modify the `PATH`.

The following environment files are supported:

* `bat` files — Windows MinGW and MSVC toolchains.

* `ps1` files — Windows MinGW, Cygwin, and MSVC toolchains.

* `shell` files — Windows Cygwin, Local Linux/macOS, WSL, Docker, and Remote toolchains. > **Tip:** > See [Set the fallback shell](#set-shell).

Most frameworks include environment scripts, which you can use right away. See the example of [ESP-IDF on macOS](esp-idf.html#env-vars-macos). You can also create your own script, for example, when you need to source several environment files: see the example of [ESP-IDF on Windows](esp-idf.html#env-vars-windows).

> **Note:**
> * Toolchain environment affects all steps performed with that particular toolchain, which includes CMake generation, build, and binary launch.
>
> * For all toolchains except [Docker](clion-toolchains-in-docker.html), environment sourcing only happens once: the first time the toolchain in used in a [CMake profile](cmake-profile.html) or upon loading a [Makefile](makefiles-support.html). For Docker, sourcing happens each time the toolchain is used.
>
> * When you make changes to the environment file, CLion re-sources it automatically by default. You can prevent the environment state from being automatically cached by unchecking the Cache environment from environment file based on file modified timestamps option in Settings | Advanced settings. Also, note that [resetting CMake](cmake-cache.html#reset-cache) invalidates the environment file cache.

Procedure:

1. In the toolchain settings, click Add environment, then click From file:

![Setting a script to initialize the environment](https://resources.jetbrains.com/help/img/idea/2026.2/cl_toolchain_env_script.png)

2. In the Environment file field, specify the path to the script:

![Environment initialization via a script](https://resources.jetbrains.com/help/img/idea/2026.2/cl_toolchain_env_script_file.png)

3. You will get notifications in case of script loading issues. CLion also checks the script loading time and terminates the execution if it takes too long.

![Environment script loading report](https://resources.jetbrains.com/help/img/idea/2026.2/cl_env_script_error.png)

Procedure: Set the fallback shell

* To source the environment file on Linux (local or remote), [WSL](how-to-use-wsl-development-environment-in-product.html), and [Docker](clion-toolchains-in-docker.html), CLion invokes `source` or `.` in default login shell as set in the `$SHELL` variable.

If `$SHELL` is empty, CLion uses the shell specified in the Fallback shell for sourcing the environment field of the [Advanced settings](advanced-settings.html).

## See also

### Procedures

[Quick CMake tutorial](quick-cmake-tutorial.html) [Makefile projects](makefiles-support.html) [Tutorial: Configure CLion on Windows](quick-tutorial-on-configuring-clion-on-windows.html)

### Reference

[Advanced Settings](advanced-settings.html)

