From b324cfdd00e5ea25cc63dbc7f11ba512151d8537 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Wed, 18 May 2022 17:23:19 +0200 Subject: [PATCH] Use mold if available as linker --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 933f6df..489c036 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,12 @@ if (SHARED) endif (SHARED) if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - add_link_options(-fuse-ld=lld) + if (EXISTS /usr/bin/mold) + message(STATUS "Mold found, using as linker") + add_link_options(-fuse-ld=mold) + else() + add_link_options(-fuse-ld=lld) + endif() # Only warn for unknown sanitizers. This error is not major enough to error on. add_compile_options(-Wno-error=unknown-sanitizers -Wno-nullability-extension -Wno-gnu-zero-variadic-macro-arguments) # Ignore pedantic nullability extension warning, as we only use this for clang specifically