From c8e33e0bbeb5fecef7db97a16c17056f5c6b28a8 Mon Sep 17 00:00:00 2001
From: Philip Trettner <trettner@shapedcode.com>
Date: Sat, 15 Feb 2025 15:20:59 +0100
Subject: [PATCH] made ld.mold the default on linux

---
 CMakeLists.txt | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d7d7d34..ecfb4f7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,8 @@ set(GLOW_USE_OWN_GLAD ON CACHE BOOL "If true, extern/glad is used")
 
 # build options
 set(GLOW_LINK_TYPE SHARED CACHE STRING "Defines the build type of libraries (shared is default)")
-set(GLOW_USE_GOLD_LINKER ON CACHE BOOL "If true, ld.gold is used for linking")
+set(GLOW_USE_MOLD_LINKER ON CACHE BOOL "If true, ld.mold is used for linking")
+set(GLOW_USE_GOLD_LINKER OFF CACHE BOOL "If true, ld.gold is used for linking")
 set(GLOW_ENABLE_MARCH_NATIVE ON CACHE BOOL "If true, adds -march=native")
 
 # misc
@@ -110,8 +111,11 @@ if(NOT MSVC)
 
     target_link_libraries(glow PUBLIC pthread)
 
+    # mold linker
+    if(GLOW_USE_MOLD_LINKER)
+        target_link_libraries(glow PUBLIC  -fuse-ld=mold)
     # gold linker
-    if(GLOW_USE_GOLD_LINKER)
+    elseif(GLOW_USE_GOLD_LINKER)
         # WRONG: target_compile_options(glow PUBLIC -fuse-ld=gold )
         target_link_libraries(glow PUBLIC  -fuse-ld=gold)
     endif()
-- 
GitLab