From dc013be1fb9f4461a5f965fbbd1619052c4c2e30 Mon Sep 17 00:00:00 2001 From: Marc Chevrier Date: Wed, 25 Oct 2023 16:30:51 +0200 Subject: Link Step: linker depfile configuration: bug fix Follow up commit 538ff514b5 (Link Step: use the correct linker for depfile handling, 2023-10-16) --- Modules/Compiler/GNU.cmake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Modules/Compiler/GNU.cmake b/Modules/Compiler/GNU.cmake index 9be7c32..bb367ea 100644 --- a/Modules/Compiler/GNU.cmake +++ b/Modules/Compiler/GNU.cmake @@ -75,7 +75,7 @@ macro(__compiler_gnu lang) if (NOT DEFINED CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) ## check if this feature is supported by the linker if (CMAKE_${lang}_COMPILER_LINKER AND CMAKE_${lang}_COMPILER_LINKER_ID MATCHES "GNU|LLD") - execute_process(COMMAND "${CMAKE_${lang}_COMPILER}" --help + execute_process(COMMAND "${CMAKE_${lang}_COMPILER_LINKER}" --help OUTPUT_VARIABLE _linker_capabilities ERROR_VARIABLE _linker_capabilities) if(_linker_capabilities MATCHES "--dependency-file") @@ -92,16 +92,17 @@ macro(__compiler_gnu lang) if (CMAKE_${lang}_LINKER_DEPFILE_SUPPORTED) set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER TRUE) else() - unset(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER) + set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE) endif() # Due to GNU binutils ld bug when LTO is enabled (see GNU bug # `30568 `_), # deactivate this feature if the version is less than 2.41. # For now, all known versions of gold linker have also this bug. - if (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNUgold" - OR (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNU" - AND CMAKE_${lang}_COMPILER_LINKER_VERSION VERSION_LESS "2.41")) + if (CMAKE_${lang}_COMPILER_LINKER_ID + AND (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNUgold" + OR (CMAKE_${lang}_COMPILER_LINKER_ID STREQUAL "GNU" + AND CMAKE_${lang}_COMPILER_LINKER_VERSION VERSION_LESS "2.41"))) set(CMAKE_${lang}_LINK_DEPENDS_USE_LINKER FALSE) endif() -- cgit v0.12