# Custom toolchain and platform files

**URL:** https://discourse.cmake.org/t/custom-toolchain-and-platform-files/15232
**Category:** Usage
**Created:** [October 10, 2025, 12:39pm UTC](https://discourse.cmake.org/t/custom-toolchain-and-platform-files/15232 "2025-10-10T12:39:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![georg](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/g/9f8e36/32.png) [@georg](https://discourse.cmake.org/u/georg)
#### Post date: [October 10, 2025, 12:39pm UTC](https://discourse.cmake.org/t/custom-toolchain-and-platform-files/15232/1 "2025-10-10T12:39:04Z")

</div>

Hi community,

we use a number of embedded toolchains and compilers for which we need to craft toolchain files for use with CMake. Most of them are deeply embedded (`Generic` platform) and mostly work without a standard library. For a single compiler there could be a couple of toolchain files depending e.g. on specific CPU core settings and SoC type.

This means that a couple of toolchain files share some common setting.

In this situation we are thinking on using own custom platform files injected by `CMAKE_MODULE_PATH` like in CMakes own module folder ([Module/Platform](https://gitlab.kitware.com/cmake/cmake/-/tree/master/Modules/Platform?ref_type=heads)), i.e. `Platform/Generic-<CMAKE_C_COMPILER_ID>-<LANG>-<CMAKE_SYSTEM_PROCESSOR>`. Local tests showed that this basically works.

But is this interface stable and save to use?

I did not find a good reference on best practices regarding toolchain files besides the simple examples in [mastering CMake](https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html#toolchain-files) and [cmake-toolchains](https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html). cmake-toolchains does not mention platform files, mastering CMake does, but does not explicitely state the exact file naming convention.

Regards  
Georg
