Toolchain examples should set CMAKE_C_COMPILER/CMAKE_CXX_COMPILER as cache variables
The cmake-toolchains manual's examples of cross-compile toolchain files should show CMAKE_C_COMPILER
and CMAKE_CXX_COMPILER
being set as CACHE
variables.
If no custom toolchain is used, CMake itself sets those variables as CACHE
variables.
My DE (VSCode with CMake Integration) was complaining about being unable to determine the compiler path and thus many features were broken. The way it determines the compiler path is by reading the CMAKE_C_COMPILER
/CMAKE_CXX_COMPILER
variables from the cache query of the CMake file API.
Showcasing the correct usage in the manual might avoid someone else the headache.