From 6d63d4d9048d7954d7d1e2bd2c758c22f926e3a5 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Tue, 7 Jan 2025 14:47:42 -0800 Subject: [PATCH] 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 --- cmake/modules/FindGnuLd.cmake | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/modules/FindGnuLd.cmake b/cmake/modules/FindGnuLd.cmake index 9ee42cc82fe..937218ecc1b 100644 --- a/cmake/modules/FindGnuLd.cmake +++ b/cmake/modules/FindGnuLd.cmake @@ -87,10 +87,11 @@ if(GNULD_LINKER) # - "GNU ld (GNU Binutils for Ubuntu) 2.34" # - "GNU ld (Zephyr SDK 0.15.2) 2.38" # - "GNU ld (Gentoo 2.39 p5) 2.39.0" + # - "GNU ld version 2.17.50.0.9 20070103" 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}) - 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()