try_compile fails when used within find_program

Hi,

I have been redirected from the issue tracker to this place. Apparently the following still warrants some discussion.

So, I am trying to cross compile from linux x86-64 to linux armv7. When using find_program(CMAKE_C_COMPILER) the generation stage fails at detecting the compiler ABI. When simply using set(CMAKE_C_COMPILER) it works as expected. To me, this appears as a bug.

I have setup a repo demonstrating the issue here: rw/CMakeFindProgramBug: Demonstrates issues with CMake's find_program when cross compiling. - CMakeFindProgramBug - Codeberg.org
You obviously will need a toolchain to reproduce. (I am using the Xilinx Zynq toolchain).

Regards,
rw