Tests/RunCMake/BuildDepends: Skip LinkDepends with broken GNU ld 2.43

Issue: #26401
This commit is contained in:
Brad King 2024-10-24 10:42:41 -04:00
parent be540dbe19
commit 92272c4a17
2 changed files with 10 additions and 4 deletions

View File

@ -1,9 +1,12 @@
enable_language(C)
file(WRITE "${CMAKE_BINARY_DIR}/LinkDependsUseLinker.cmake"
"set(CMAKE_LINK_DEPENDS_USE_LINKER ${CMAKE_LINK_DEPENDS_USE_LINKER})
set(CMAKE_C_LINK_DEPENDS_USE_LINKER ${CMAKE_C_LINK_DEPENDS_USE_LINKER})\n")
file(WRITE "${CMAKE_BINARY_DIR}/LinkDependsUseLinker.cmake" "
set(CMAKE_LINK_DEPENDS_USE_LINKER ${CMAKE_LINK_DEPENDS_USE_LINKER})
set(CMAKE_C_LINK_DEPENDS_USE_LINKER ${CMAKE_C_LINK_DEPENDS_USE_LINKER})
set(CMAKE_C_COMPILER_LINKER_ID ${CMAKE_C_COMPILER_LINKER_ID})
set(CMAKE_C_COMPILER_LINKER_VERSION ${CMAKE_C_COMPILER_LINKER_VERSION})
")
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake"

View File

@ -208,7 +208,10 @@ if (RunCMake_GENERATOR MATCHES "Make|Ninja")
run_BuildDepends(LinkDependsCheck)
include("${RunCMake_BINARY_DIR}/LinkDependsCheck-build/LinkDependsUseLinker.cmake")
if ((NOT DEFINED CMAKE_LINK_DEPENDS_USE_LINKER OR CMAKE_LINK_DEPENDS_USE_LINKER)
AND CMAKE_C_LINK_DEPENDS_USE_LINKER)
AND CMAKE_C_LINK_DEPENDS_USE_LINKER
# FIXME(#26401): GNU binutils 2.43 broke dependency-file generation.
AND NOT (CMAKE_C_COMPILER_LINKER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_LINKER_VERSION VERSION_GREATER_EQUAL "2.43")
)
run_BuildDepends(LinkDependsExternalLibrary)
unset(run_BuildDepends_skip_step_2)
run_BuildDepends(LinkDepends -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES})