diff options
author | Brad King <brad.king@kitware.com> | 2022-03-15 16:58:45 -0400 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-03-16 10:46:11 -0400 |
commit | fee36b7a784543c3d89e2ef7c531e6892116f237 (patch) | |
tree | fa305b27090bcf993fb99397a85b5ff0753eeccf /Modules/CMakeFindBinUtils.cmake | |
parent | bb99538a45424c880021356139cb51f8873876c7 (diff) | |
download | cmake-fee36b7a784543c3d89e2ef7c531e6892116f237.tar.gz |
BinUtils: Restore llvm-ar fallback on Apple platforms
Since commit 29ea94e17c (BinUtils: Avoid llvm-ar on Apple platforms,
2022-03-03, v3.21.6~1^2) we do not consider `llvm-ar` at all on Apple
platforms. However, there are existing cross-compiling use cases in
which the toolchain has `llvm-ar` but not `ar`. Prior to the
re-ordering in commit cf82300a63 (BinUtils: Clarify search logic and
make it more consistent, 2021-05-27, v3.21.0-rc1~119^2~2), we preferred
`ar` and then `llvm-ar`. Restore the original order for Apple.
Fixes: #23320
Diffstat (limited to 'Modules/CMakeFindBinUtils.cmake')
-rw-r--r-- | Modules/CMakeFindBinUtils.cmake | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index 01cb161b3f..84fde49ce9 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -173,8 +173,13 @@ else() else() list(PREPEND _CMAKE_LINKER_NAMES "ld.lld") endif() - if(NOT APPLE) + if(APPLE) # llvm-ar does not generate a symbol table that the Apple ld64 linker accepts. + # FIXME(#23333): We still need to consider 'llvm-ar' as a fallback because + # the 'APPLE' definition may be based on the host in this context, and a + # cross-compiling toolchain may not have 'ar'. + list(APPEND _CMAKE_AR_NAMES "llvm-ar") + else() list(PREPEND _CMAKE_AR_NAMES "llvm-ar") endif() list(PREPEND _CMAKE_RANLIB_NAMES "llvm-ranlib") |