From 37140aa9f724f2c5a7350f39108f0566cfd89d2b Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Tue, 21 Jan 2025 01:29:52 +0100
Subject: [PATCH] cmake: expand libunwind
---
cmake/sdlchecks.cmake | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 890e9186b751b..d95cbfa3a1a8a 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -1245,7 +1245,21 @@ endmacro()
macro(CheckLibUnwind)
if(TARGET SDL3_test)
set(found_libunwind FALSE)
- set(_libunwind_src "#include <libunwind.h>\nint main() {unw_context_t context; unw_getcontext(&context); return 0;}")
+ set(_libunwind_src [==[
+ #include <libunwind.h>
+ int main(int argc, char *argv[]) {
+ (void)argc; (void)argv;
+ unw_context_t context;
+ unw_cursor_t cursor;
+ unw_word_t pc;
+ char sym[256];
+ unw_word_t offset;
+ unw_getcontext(&context);
+ unw_step(&cursor);
+ unw_get_reg(&cursor, UNW_REG_IP, &pc);
+ unw_get_proc_name(&cursor, sym, sizeof(sym), &offset);
+ return 0;
+ }]==])
if(NOT found_libunwind)
cmake_push_check_state()