cmake: add support for libbacktrace, fix two build issues

Also:
- memdebug: fix symbol collision in unity builds.
- memdebug: fix compiler warning by making a variable static.

Follow-up to c77bed81a2 #19657

Closes #19666
This commit is contained in:
Viktor Szakats 2025-11-24 12:49:15 +01:00
parent 039fb84cb4
commit d03712169b
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
7 changed files with 80 additions and 4 deletions

View file

@ -1421,6 +1421,21 @@ if(CURL_USE_GSSAPI)
endif()
endif()
# libbacktrace
option(CURL_USE_LIBBACKTRACE "Use libbacktrace. Requires build with TrackMemory and DWARF debug information." OFF)
if(CURL_USE_LIBBACKTRACE)
if(NOT ENABLE_CURLDEBUG)
message(FATAL_ERROR "libbacktrace requires TrackMemory enabled")
endif()
if(NOT CMAKE_BUILD_TYPE MATCHES "(Debug|RelWithDebInfo)")
message(FATAL_ERROR "libbacktrace requires debug information")
endif()
find_package(Libbacktrace REQUIRED)
list(APPEND CURL_LIBS ${LIBBACKTRACE_LIBRARIES})
include_directories(SYSTEM ${LIBBACKTRACE_INCLUDE_DIRS})
set(USE_BACKTRACE ON)
endif()
# libuv
option(CURL_USE_LIBUV "Use libuv for event-based tests" OFF)
if(CURL_USE_LIBUV)