From 67b7bcc98b544cadf668a90411987fb69d0973fe Mon Sep 17 00:00:00 2001
From: Scott Talbert <swt@techie.net>
Date: Sun, 10 Mar 2024 20:34:38 -0400
Subject: [PATCH 3/3] Add build option for using the default linker

---
 CMakeLists.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2ce914ab92..a3887a3223 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -142,6 +142,7 @@ cvc5_option(STATIC_BINARY "Link against static system libraries \
 
 option(SKIP_COMPRESS_DEBUG "Skip compression of debug symbols")
 option(SKIP_SET_RPATH      "Skip setting of rpath")
+option(USE_DEFAULT_LINKER  "Use default linker")
 
 # Custom flags for WebAssembly compilation
 set(WASM_FLAGS "" CACHE STRING "Link flags for the WebAssembly binary generation")
@@ -239,7 +240,7 @@ endif ()
 
 # Changing the default linker on MSYS prevents the build system from
 # using the GMP system library if available
-if (NOT ("${CMAKE_GENERATOR}" STREQUAL "MSYS Makefiles"))
+if (NOT ("${CMAKE_GENERATOR}" STREQUAL "MSYS Makefiles") AND NOT USE_DEFAULT_LINKER)
   #-----------------------------------------------------------------------------#
   # Use ld.mold if available, otherwise use ld.gold if available
 
-- 
2.43.0

