From: Daniel Arndt Date: Wed, 7 Feb 2018 00:32:26 +0000 (+0100) Subject: Improve detection of ld.gold X-Git-Tag: v9.0.0-rc1~461^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6c723d7980a7cddfa91375093eb024a257ffdda;p=dealii.git Improve detection of ld.gold --- 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(