Why does project() change CMAKE_TOOLCHAIN_FILE only on first configure?

Consider:

# CMakeLists.txt
cmake_minimum_required(VERSION 3.25)
message("Toolchain: ${CMAKE_TOOLCHAIN_FILE}")
project(ToolchainTest)
message("Toolchain: ${CMAKE_TOOLCHAIN_FILE}")
# toolchain.cmake (empty file)

On first/clean configure:

> cmake -B build --toolchain toolchain.cmake .
Toolchain: toolchain.cmake
Toolchain: /Users/user/Desktop/ToolchainTest/toolchain.cmake

On subsequent configures:

> cmake -B build --toolchain toolchain.cmake .
Toolchain: toolchain.cmake
Toolchain: toolchain.cmake

Why does the toolchain have an absolute path after project() is called, but only on first configure?

The behavior is the same if I specify the toolchain using -DCMAKE_TOOLCHAIN_FILE.

I am running CMake 3.25.2

I guess it’s because on subsequent runs CMake skips the whole compiler detection (it’s already done the first time, so why waste resources), so it also does not bother to even look at this variable anymore.