# Set default toolchain system-wide

**URL:** https://discourse.cmake.org/t/set-default-toolchain-system-wide/1373
**Category:** Usage
**Created:** [June 11, 2020, 3:06pm UTC](https://discourse.cmake.org/t/set-default-toolchain-system-wide/1373 "2020-06-11T15:06:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Achpile](https://discourse.cmake.org/user_avatar/discourse.cmake.org/achpile/32/680_2.png) [@Achpile](https://discourse.cmake.org/u/Achpile)
#### Post date: [June 11, 2020, 3:06pm UTC](https://discourse.cmake.org/t/set-default-toolchain-system-wide/1373/1 "2020-06-11T15:06:24Z")

</div>

Good day. I use cmake on linux for cross-compilation. For both 32 and 64 systems i have separate “chroots”. Now I also want to add one for windows as well to compile with mingw. So the question is - can I set up mingw toolchain as default for cmake in this chroot? Just to avoid setting “-DCMAKE\_TOOLCHAIN\_FILE” every time

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [June 11, 2020, 3:27pm UTC](https://discourse.cmake.org/t/set-default-toolchain-system-wide/1373/2 "2020-06-11T15:27:03Z")

</div>

This sounds like a good case for adding a `CMAKE_TOOLCHAIN_FILE` [environment variable](https://cmake.org/cmake/help/latest/manual/cmake-env-variables.7.html).

---

<div class="post-metadata">

### Author: ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)
#### Post date: [June 12, 2020, 7:14am UTC](https://discourse.cmake.org/t/set-default-toolchain-system-wide/1373/3 "2020-06-12T07:14:10Z")

</div>

No, please don’t unless you can specify by command line that you do NOT want to use a toolchain file. How many environment variables are we supposed to clear in setup scripts to get a well defined behavior?

This rather sounds like a simple bash alias.
