# try\_compile fails when used within find\_program

**URL:** https://discourse.cmake.org/t/try-compile-fails-when-used-within-find-program/6815
**Category:** Usage
**Tags:** os:linux
**Created:** [November 8, 2022, 7:33pm UTC](https://discourse.cmake.org/t/try-compile-fails-when-used-within-find-program/6815 "2022-11-08T19:33:49Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rwi](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/r/cc9497/32.png) [@rwi](https://discourse.cmake.org/u/rwi)
#### Post date: [November 8, 2022, 7:33pm UTC](https://discourse.cmake.org/t/try-compile-fails-when-used-within-find-program/6815/1 "2022-11-08T19:33:49Z")

</div>

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](https://codeberg.org/rw/CMakeFindProgramBug)  
You obviously will need a toolchain to reproduce. (I am using the Xilinx Zynq toolchain).

Regards,  
rw
