# cdlist.h warnings. Remove when fixed.
add_check_cxx_flag("-Wno-class-memaccess")
+#-----------------------------------------------------------------------------#
+# Use ld.gold if available
+
+execute_process(COMMAND ${CMAKE_C_COMPILER}
+ -fuse-ld=gold
+ -Wl,--version ERROR_QUIET OUTPUT_VARIABLE LD_VERSION)
+if ("${LD_VERSION}" MATCHES "GNU gold")
+ string(APPEND CMAKE_EXE_LINKER_FLAGS " -fuse-ld=gold")
+ string(APPEND CMAKE_SHARED_LINKER_FLAGS " -fuse-ld=gold")
+ string(APPEND CMAKE_MODULE_LINKER_FLAGS " -fuse-ld=gold")
+ message(STATUS "Using GNU gold linker.")
+endif ()
+
#-----------------------------------------------------------------------------#
# Option defaults (three-valued options (cvc4_option(...)))
#