cmake: modules/FindGnuLd: support an additional obselete version format

A legacy build of GNU ld emits the following version string:

GNU ld version 2.17.50.0.9 20070103

This patch fixes the regex parsing so that the version number is correctly
extracted from the string.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
This commit is contained in:
Joel Holdsworth 2025-01-07 14:47:42 -08:00 committed by Benjamin Cabé
commit 6d63d4d904

View file

@ -87,10 +87,11 @@ if(GNULD_LINKER)
# - "GNU ld (GNU Binutils for Ubuntu) 2.34" # - "GNU ld (GNU Binutils for Ubuntu) 2.34"
# - "GNU ld (Zephyr SDK 0.15.2) 2.38" # - "GNU ld (Zephyr SDK 0.15.2) 2.38"
# - "GNU ld (Gentoo 2.39 p5) 2.39.0" # - "GNU ld (Gentoo 2.39 p5) 2.39.0"
# - "GNU ld version 2.17.50.0.9 20070103"
string(REGEX MATCH string(REGEX MATCH
"GNU ld \\(.+\\) ([0-9]+[.][0-9]+[.]?[0-9]*).*" "GNU ld (\\(.+\\)|version) ([0-9]+[.][0-9]+[.]?[0-9]*).*"
out_var ${gnuld_version_output}) out_var ${gnuld_version_output})
set(GNULD_VERSION_STRING ${CMAKE_MATCH_1} CACHE STRING "GNU ld version" FORCE) set(GNULD_VERSION_STRING ${CMAKE_MATCH_2} CACHE STRING "GNU ld version" FORCE)
endif() endif()
endif() endif()