Skip to content
  • Lingkai Dong's avatar
    ARMClang: Fix regression in check for working compiler · 509ef50a
    Lingkai Dong authored and Brad King's avatar Brad King committed
    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, which is set to NEW in the test
    for a working compiler, setting a CACHE entry does not replace a normal
    entry of the same name anymore, resulting in a failed test due to wrong
    linker and archiver.
    
    To fix this, set CMAKE_LINKER and CMAKE_AR for ARMClang directly in
    `CMakeFindBinUtils.cmake` as is done for other compilers.  Check
    for them in `ARMClang.cmake` to safeguard cases when a project explicitly
    includes `ARMClang.cmake` prior to compiler determination (which some
    projects do to work around other problems in older CMake versions).
    509ef50a