diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2023-10-25 14:30:51 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2023-10-25 14:37:30 (GMT) |
commit | dc013be1fb9f4461a5f965fbbd1619052c4c2e30 (patch) | |
tree | 406eed78742c53a786867e919db130f6dce48a73 /Modules/Compiler | |
parent | 35424aab2e35ae5e4e3762feae26a0c305c73b9d (diff) | |
download | CMake-dc013be1fb9f4461a5f965fbbd1619052c4c2e30.zip CMake-dc013be1fb9f4461a5f965fbbd1619052c4c2e30.tar.gz CMake-dc013be1fb9f4461a5f965fbbd1619052c4c2e30.tar.bz2 |
Link Step: linker depfile configuration: bug fix
Follow up commit 538ff514b5 (Link Step: use the correct linker
for depfile handling, 2023-10-16)
Diffstat (limited to 'Modules/Compiler')
-rw-r--r-- | Modules/Compiler/GNU.cmake | 11 |
1 files 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 <https://sourceware.org/bugzilla/show_bug.cgi?id=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() |