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