Skip to content

ARMClang: Fix regression in check for working compiler

Lingkai Dong requested to merge LDong-Arm/cmake:armlink_armar_detection into master

Given the compiler to use, CMakeFindBinUtils.cmake automatically determines a number of tools including linker (CMAKE_LINKER) and archiver (CMAKE_AR) and stores them in a generated file CMakeCCompiler.cmake as non-CACHE entries. The compiler-specific ARMClang.cmake then tries to override CMAKE_LINKER and CMAKE_AR as CACHE entries.

Following the introduction of CMP0126, setting a CACHE entry does not replace a normal entry of the same name anymore, resulting in failed C compiler test due to wrong linker and archiver.

To fix this, set CMAKE_LINKER and CMAKE_AR for ARMClang directly in CMakeFindBinUtils.cmake in a similar way to some other compilers. The two variables are checked in ARMClang.cmake to safeguard cases when a project explicitly includes ARMClang.cmake prior to compiler determination.

Backport: release

Edited by Brad King

Merge request reports