From a6c723d7980a7cddfa91375093eb024a257ffdda Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 7 Feb 2018 01:32:26 +0100 Subject: [PATCH] Improve detection of ld.gold --- cmake/checks/check_01_compiler_features.cmake | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cmake/checks/check_01_compiler_features.cmake b/cmake/checks/check_01_compiler_features.cmake index 479d274b3b..9341c1afcc 100644 --- a/cmake/checks/check_01_compiler_features.cmake +++ b/cmake/checks/check_01_compiler_features.cmake @@ -408,11 +408,21 @@ RESET_CMAKE_REQUIRED() # Use the 'gold' linker if possible, given that it's substantially faster. # # We have to try to link a full executable with -fuse-ld=gold to check -# whether "ld.gold" is actually available. gcc has the bad habit of -# accepting the flag without emitting an error. +# whether "ld.gold" is actually available. # -# Wolfgang Bangerth, Matthias Maier, 2015 +# Clang always reports "argument unused during compilation" +# if "-fuse-ld=" is used, but fails at link time for an unsupported linker. # +# ICC also emits a warning but passes for unsupported linkers +# unless we turn diagnostic warnings into errors. +# +# Wolfgang Bangerth, Matthias Maier, Daniel Arndt, 2015, 2018 +# +IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + PUSH_CMAKE_REQUIRED("-Wno-unused-command-line-argument") +ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "Intel") + PUSH_CMAKE_REQUIRED("-diag-error warn") +ENDIF() PUSH_CMAKE_REQUIRED("-Werror") PUSH_CMAKE_REQUIRED("-fuse-ld=gold") CHECK_CXX_SOURCE_COMPILES( -- 2.39.5