diff options
author | Brad King <brad.king@kitware.com> | 2022-03-03 17:52:37 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-03-03 17:54:10 (GMT) |
commit | 29ea94e17c61b485f5cd1036e0ba8282b44ebb0e (patch) | |
tree | f612b2c1ca077dff607ca07597d14ea2f26cb818 /Modules | |
parent | 02b04f1ca8d13410feeebb51756619b8f9d80a22 (diff) | |
download | CMake-29ea94e17c61b485f5cd1036e0ba8282b44ebb0e.zip CMake-29ea94e17c61b485f5cd1036e0ba8282b44ebb0e.tar.gz CMake-29ea94e17c61b485f5cd1036e0ba8282b44ebb0e.tar.bz2 |
BinUtils: Avoid llvm-ar on Apple platforms
Since commit cf82300a63 (BinUtils: Clarify search logic and make it more
consistent, 2021-05-27, v3.21.0-rc1~119^2~2) we correctly prefer the
more-specific name `llvm-ar` over `ar` when using Clang. However, on
Apple platforms, `llvm-ar` does not generate a symbol table that the
Apple linker accepts. Fall back to `ar` on Apple platforms.
Fixes: #23269
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeFindBinUtils.cmake | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake index f3c2345..ba7c405 100644 --- a/Modules/CMakeFindBinUtils.cmake +++ b/Modules/CMakeFindBinUtils.cmake @@ -172,7 +172,10 @@ else() else() list(PREPEND _CMAKE_LINKER_NAMES "ld.lld") endif() - list(PREPEND _CMAKE_AR_NAMES "llvm-ar") + if(NOT APPLE) + # llvm-ar does not generate a symbol table that the Apple ld64 linker accepts. + list(PREPEND _CMAKE_AR_NAMES "llvm-ar") + endif() list(PREPEND _CMAKE_RANLIB_NAMES "llvm-ranlib") if("${CMAKE_${_CMAKE_PROCESSING_LANGUAGE}_COMPILER_VERSION}" VERSION_GREATER_EQUAL 11) # llvm-strip versions prior to 11 require additional flags we do not yet add. |