From aa4c30182b0c258cddfb0582e7cfc2561b69a378 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx@gmail.com>
Date: Sun, 18 Jul 2021 16:32:38 +0700
Subject: [PATCH] Add option to explicitly avoid using execinfo for backtraces

backtrace(3) from libexecinfo in musl will run into crash [1].

Provide an option to disable it explicitly even if libexecinfo is
present.

1: https://www.openwall.com/lists/musl/2021/07/17/1
---
 CMakeLists.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 44b433ac8f2..9944ea4ce37 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -361,6 +361,9 @@ macro (CMAKE_BUILD_UTILITIES)
   if(CMake_NO_CXX_STANDARD)
     set(KWSYS_CXX_STANDARD "")
   endif()
+  if(CMake_NO_SELF_BACKTRACE)
+    set(KWSYS_NO_EXECINFO 1)
+  endif()
   if(WIN32)
     # FIXME: Teach KWSys to hard-code these checks on Windows.
     set(KWSYS_C_HAS_CLOCK_GETTIME_MONOTONIC_COMPILED 0)
-- 
GitLab