Include guards in toolchain files

I recently came accross some (rare) examples/code snippets, where the include_guard([GLOBAL]) command is used inside a toolchain file, e.g. [1], [2], [3].

I understand the general purpose of include guards in modules, but I am unsure if they are useful or misplaced in toolchain files. As far as I know the toolchain is intentionally processed multiple times every time a new language gets enabled by a project() or enable_language() call. This made me wonder, if an include guard could possibly cause problems?

I would appreciate if someone with more expertise regarding toolchains could explain to me possible advantages/disadvantages/pitfalls and if using include guards in toolchain files is considered a good/valid thing to do or if it is discouraged.

1 Like

Would be interessted too