From f4e2837b9293a46c98d738f28d11a561ad8c508f Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Wed, 18 May 2022 17:22:19 +0200 Subject: [PATCH] Use mold as linker if available for clang. --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c84d85..c719785 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,12 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") endif () 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) # Ignore pedantic nullability extension warning, as we only use this for clang specifically @@ -119,7 +124,7 @@ endif () if (CMAKE_BUILD_TYPE MATCHES Release AND NOT WINDOWS) # Include debug symbols in all linux builds - message("Including debug symbols") + message(STATUS "Including debug symbols") add_compile_options(-g -gline-tables-only) endif () @@ -202,7 +207,6 @@ if (SCRIPT_PROVIDER STREQUAL "angelscript") elseif (SCRIPT_PROVIDER STREQUAL "wasm") message(STATUS "Using WebAssembly as script provider.") target_link_directories(pkmnLib PUBLIC $ENV{WASMER_DIR}/lib) - message($ENV{WASMER_DIR}/lib) ADD_DEFINITIONS(-D WASM=1) SET(_LINKS ${_LINKS} -Wl,-Bstatic wasmer -Wl,-Bdynamic) SET(_TESTLINKS ${_TESTLINKS} -Wl,-Bstatic wasmer -Wl,-Bdynamic)