Is CMakeCCompilerId.c used on the target or host system? How to tell Cmake which build system to use?

Thanks for assisting me in understanding what is going on.

I don’t think my original question is related to qt; except in the sense that CMake is used to cross-compile qt similar to what I’m trying to do.

Also, I’m not trying to build executables or libraries for two different targets. My target is an ARM Cortex M0+ chip with CMake and the build and compilation tools are executing on a Windows 10 machine. CMake in its wisdom produces the files CMakeCCompilerId.c and CMakeCXXCompilerId.c whose utility and use is unclear ( at least to me!).

I suspect that they are used to validate or identify the cross-compiler used in the build. So if this is true, wouldn’t they be run on the machine hosting the cross compiler ( i.e. the Win10 machine.)?

However, the evidence seems to point toward CMake compiling them for the target and then cannot find the supporting libraries ( e.g. _exit() ) which is not used on the target. This causes the CMake to fail and therefore never get to “making” the files intended to be built for the target.

Perhaps if I understood the two files use/utility in the build process I could make some progress in correcting the error.

I presumed, probably incorrectly, that CMake would have commands to control the build of these two files to assure that they are tools executed on the host where the cross compiler runs. It is also quite possible ( and becoming more likely by the day ) that I’m missing a key piece of understanding of CMake.

I appreciate your taking the time to explain more of what is going on.