message(STATUS "Ccache dev mode: ${CCACHE_DEV_MODE}")
include(UseCcache)
-if(NOT MSVC)
- include(UseFastestLinker)
-endif()
+include(UseFastestLinker)
include(StandardSettings)
include(StandardWarnings)
include(CIBuildType)
+if(NOT CCACHE_DEV_MODE)
+ # For ccache, using a faster linker is in practice only relevant to reduce the
+ # compile-link-test cycle for developers, so use the standard linker for
+ # non-developer builds.
+ return()
+endif()
+
+if(MSVC)
+ message(STATUS "Using standard linker for MSVC")
+ return()
+endif()
+
+if(NOT CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
+ # Be conservative and only probe for a faster linker on platforms that likely
+ # don't have toolchain bugs. See for example
+ # <https://www.sourceware.org/bugzilla/show_bug.cgi?id=22838>.
+ message(STATUS "Not probing for faster linker on ${CMAKE_SYSTEM_PROCESSOR}")
+ return()
+endif()
+
function(check_linker linker)
string(TOUPPER ${linker} upper_linker)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/CMakefiles/CMakeTmp/main.c" "int main() { return 0; }")