From: Mathias Preiner Date: Mon, 10 Feb 2020 19:34:11 +0000 (-0800) Subject: cmake: Use ld.gold if available for faster link times. (#3738) X-Git-Tag: cvc5-1.0.0~3664 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=779f9cd3c0f9a3620a52c30a853bde9e7b911494;p=cvc5.git cmake: Use ld.gold if available for faster link times. (#3738) --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c187eff3..e5d0cf0e5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -240,6 +240,19 @@ add_check_c_cxx_flag("-Wimplicit-fallthrough") # 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(...))) #