From 99d879ad3271e94b58b0bc7761c0ca1c844949d5 Mon Sep 17 00:00:00 2001 From: funky-yellow-wombat <159799945+funky-yellow-wombat@users.noreply.github.com> Date: Mon, 17 Feb 2025 15:07:32 +0000 Subject: [PATCH] Support GLIBC Version Targeting Support GLIBC version targeting, example: `cmake -B build -G Ninja --toolchain cmake/x86_64-linux-gnu.2.17.cmake` (You would need to create this file) Because `NAME_WL` was used all extension info was lost, with `NAME_WLE` along with the regex change on the ABI match group we're able to recover and use the full ABI target string from the filename. https://github.com/ziglang/zig/tree/master/lib/libc/glibc#zig-gnu-c-library-glibc-support --- cmake/zig-toolchain.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/zig-toolchain.cmake b/cmake/zig-toolchain.cmake index f6ee21a..3826df5 100644 --- a/cmake/zig-toolchain.cmake +++ b/cmake/zig-toolchain.cmake @@ -8,11 +8,11 @@ if(NOT DEFINED ZIG_TARGET) get_filename_component(PARENT_LIST_DIR "${CMAKE_PARENT_LIST_FILE}" DIRECTORY) string(FIND "${CMAKE_CURRENT_LIST_DIR}" "${PARENT_LIST_DIR}" POS) if(POS EQUAL 0) - get_filename_component(ZIG_TARGET "${CMAKE_PARENT_LIST_FILE}" NAME_WE) + get_filename_component(ZIG_TARGET "${CMAKE_PARENT_LIST_FILE}" NAME_WLE) endif() endif() -if(NOT ZIG_TARGET MATCHES "^([a-zZ-Z0-9_]+)-([a-zZ-Z0-9_]+)-([a-zZ-Z0-9_]+)$") +if(NOT ZIG_TARGET MATCHES "^([a-zZ-Z0-9_]+)-([a-zZ-Z0-9_]+)-([a-zZ-Z0-9_.]+)$") message(FATAL_ERROR "Expected ZIG_TARGET=--") endif()