add stack trace information to the compiler and linker (#19879)
Costa Tsaousis committed
Mar 16, 2025 at 22:22 UTC
3bdaed8c2e4961694f2211251560caa5dad0894e
1 file changed
+4
-6
CMakeLists.txt
+4
-6
@@ -487,12 +487,10 @@ check_function_exists(sysinfo HAVE_SYSINFO)
487
488
check_function_exists(timegm HAVE_TIMEGM)
489
490
-# Add -rdynamic when backtrace is available but libunwind is not
491
-if(HAVE_BACKTRACE AND NOT ENABLE_LIBUNWIND AND NOT STATIC_BUILD)
492
- if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
493
- add_link_options(-rdynamic)
494
- message(STATUS "Adding -rdynamic to link options for better backtrace support")
495
- endif()
490
+if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
491
+ add_compile_options(-funwind-tables)
492
+ add_link_options(-rdynamic)
493
+ message(STATUS "Adding -rdynamic (link) and -funwind-tables (compile) for better stack trace support")
494
endif()
495
496
#