Why does source file try_compile not propagate CMAKE_TOOLCHAIN_FILE to the generated project?

Looking at the generated CMakeCache.txt of a try_compile project (via --debug-trycompile), I do not see a CMAKE_TOOLCHAIN_FILE cache entry, even if one was passed to the project.

In my particular case I pass the Google provided Android toolchain.

I am aware that it’s possible to set CMAKE_TRY_COMPILE_PLATFORM_VARIABLES, but shouldn’t the toolchain always propagated to source try_compile projects?

Otherwise wouldn’t the Android toolchain logic not be executed for the try_compile project?

The CMAKE_TOOLCHAIN_FILE isn’t forwarded as a cache variable for try_compile.
It is included in the CMakeSystem.cmake file that describes the build system.

If you put a message( "CMAKE_TOOL_CHAIN in use") command in the toolchain file you’ll see its output during a try_compile.