From c57569a4ff1a942259bd8d6d057cd75b08ac64be Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 1 Feb 2017 13:46:33 +1100 Subject: [PATCH] cmake: more reliable backtrace strategy discovery --- CMakeLists.txt | 25 +++++++++---------------- cmake | 2 +- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f37f0ed9..a7f587cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,16 +38,21 @@ set (UTIL_FILES) ############################################################################### search_libs (BACKTRACE_LIB backtrace execinfo) -check_function_exists (RtlCaptureStackBackTrace HAVE_CAPTURESTACKBACKTRACE) search_libs (DBGHELP_LIB SymFromAddr dbghelp) -check_function_exists(RtlCaptureStackBackTrace HAVE_STACKWALK) +check_function_exists (RtlCaptureStackBackTrace HAVE_CAPTURESTACKBACKTRACE) ##----------------------------------------------------------------------------- -if (BACKTRACE_LIB) - list (APPEND backtrace_files execinfo) +if (BACKTRACE_LIB_FOUND) + list (APPEND UTIL_FILES backtrace_execinfo.cpp) +elseif (HAVE_CAPTURESTACKBACKTRACE) + list (APPEND UTIL_FILES backtrace_stackwalk.cpp) +else () + list (APPEND UTIL_FILES backtrace_null.cpp) endif () + +##----------------------------------------------------------------------------- if (NOT WIN32) find_program(ADDR2LINE NAMES addr2line) if (ADDR2LINE) @@ -56,18 +61,6 @@ if (NOT WIN32) endif () -##----------------------------------------------------------------------------- -if (HAVE_CAPTURESTACKBACTRACE) - list (APPEND backtrace_files stackwalk win32) -endif () - - -##----------------------------------------------------------------------------- -list (APPEND backtrace_files null) -list (GET backtrace_files 0 backtrace_scheme) -list (APPEND UTIL_FILES backtrace_${backtrace_scheme}.cpp) - - ############################################################################### # Platform wrappers if (LINUX) diff --git a/cmake b/cmake index d106a052..45be8435 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit d106a052a1aa844bc074f6025df4a454d6daf9be +Subproject commit 45be843568fb894d7ca2e33a485be0b6998acf92