blob: ae46d3274f50bf24792eb7aa07b1ba58aa85f864 [file] [log] [blame]
Link libexecinfo if its found, this is needed for musl based systems
Fixes
ld: libglog.so.0.4.0: undefined reference to `backtrace'
| collect2: error: ld returned 1 exit status
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,6 +115,7 @@ check_cxx_compiler_flag (-Wunnamed-type-
check_symbol_exists (snprintf stdio.h HAVE_SNPRINTF)
check_library_exists (dbghelp UnDecorateSymbolName "" HAVE_DBGHELP)
+check_library_exists (execinfo backtrace "" HAVE_EXECINFO)
find_package(Libunwind)
@@ -471,6 +472,10 @@ if (Libunwind_FOUND)
target_link_libraries (glog PUBLIC unwind)
endif (Libunwind_FOUND)
+if (HAVE_EXECINFO)
+ target_link_libraries (glog PUBLIC execinfo)
+endif (HAVE_EXECINFO)
+
if (HAVE_DBGHELP)
target_link_libraries (glog PUBLIC dbghelp)
endif (HAVE_DBGHELP)