backtrace support rework proposal.

Linux/Solaris supports it in the libc however, BSD in general, Haiku
relies on an external library.
This commit is contained in:
David Carlier 2020-08-03 10:10:33 +00:00
parent 9136c8705a
commit 0200434187
2 changed files with 16 additions and 6 deletions

View file

@ -103,11 +103,21 @@ find_package(OpenGL REQUIRED)
list(APPEND yquake2IncludeDirectories ${OPENGL_INCLUDE_DIR})
list(APPEND yquake2OpenGLLinkerFlags ${OPENGL_LIBRARIES})
# FreeBSD needs libexecinfo.
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
find_library(EXECINFO_LIBRARIES execinfo /usr/lib /usr/local/lib)
list(APPEND yquake2ClientLinkerFlags ${EXECINFO_LIBRARIES})
list(APPEND yquake2ServerLinkerFlags ${EXECINFO_LIBRARIES})
# backtrace lookup
# Some systems like Linux has it within the libc some like the BSD, Haiku ...
# into an external libexecinfo library
include(CheckFunctionExists)
include(CheckLibraryExists)
check_function_exists(backtrace HAVE_EXECINFO_SYS)
IF (NOT HAVE_EXECINFO_SYS)
check_library_exists(execinfo backtrace "" HAVE_EXECINFO_LIB)
if (HAVE_EXECINFO_LIB)
list(APPEND yquake2ClientLinkerFlags execinfo)
list(APPEND yquake2ServerLinkerFlags execinfo)
add_definitions(-DHAVE_EXECINFO)
endif()
else()
add_definitions(-DHAVE_EXECINFO)
endif()
# cURL support.

View file

@ -30,7 +30,7 @@
#include "../../common/header/common.h"
#if defined(__GLIBC__) || defined(__FreeBSD__) || defined(__APPLE__)
#if defined(HAVE_EXECINFO)
#include <execinfo.h>
void