Creating toolchain files
Toolchain files might seem intimidating at first, but on a closer look, they are often relatively trivial. The misconception that defining cross-compilation toolchains is hard stems from the fact that there are many overly complicated examples of toolchain files found on the internet. Many of them were written for early versions of CMake and thus implemented many additional tests and checks that are now part of CMake itself. CMake toolchain files basically do the following things:
- Define the target system and architecture.
- Provide paths to any tools needed to build the software for the defined platform. Often, these are just compilers.
- Set default flags for the compiler and linkers.
- Point to the sysroot and possibly any staging directory if cross-compiling.
- Set hints for the search order for any
find_
commands of CMake. Changing the search order is something the project might define, and it is debatable whether this belongs in the...