[all] allow disable of backtrace support during build

This commit is contained in:
Geoffrey McRae
2019-06-19 09:13:03 +10:00
parent d7fa0aeff9
commit 4cf6dec592
5 changed files with 26 additions and 3 deletions

View File

@@ -5,6 +5,10 @@ include_directories(
${PROJECT_SOURCE_DIR}/include
)
if(ENABLE_BACKTRACE)
add_definitions(-DENABLE_BACKTRACE)
endif()
set(COMMON_SOURCES
src/stringutils.c
src/stringlist.c
@@ -27,7 +31,9 @@ if(WIN32)
else()
set(SOURCES ${COMMON_SOURCES} ${LINUX_SOURCES})
add_library(lg_common STATIC ${SOURCES})
target_link_libraries(lg_common bfd)
if(ENABLE_BACKTRACE)
target_link_libraries(lg_common bfd)
endif()
endif()
target_include_directories(lg_common

View File

@@ -21,6 +21,8 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "common/crash.h"
#include "common/debug.h"
#if defined(ENABLE_BACKTRACE)
#include <execinfo.h>
#include <signal.h>
#include <stdio.h>
@@ -219,4 +221,13 @@ bool installCrashHandler(const char * exe)
}
return true;
}
}
#else //ENABLE_BACKTRACE
bool installCrashHandler(const char * exe)
{
return true;
}
#endif