Fix #111186: Crash backtrace missing on Linux

Regression in [0] which caused `execinfo.h` not to be detected by CMake.

Setting a default variable for other platforms prevented the new
variable from being set.

[0]: f197b1a1f1
This commit is contained in:
Campbell Barton 2023-08-17 13:45:11 +10:00
parent 5478798526
commit 8d26dda40c
1 changed files with 6 additions and 2 deletions

View File

@ -16,15 +16,16 @@ check_symbol_exists(malloc_stats "malloc.h" HAVE_MALLOC_STATS_H)
# Used for: `source/creator/creator_signals.c`.
# The function `feenableexcept` is not present non-GLIBC systems,
# hence we need to check if it's available in the `fenv.h` file.
set(HAVE_FEENABLEEXCEPT OFF)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
check_symbol_exists(feenableexcept "fenv.h" HAVE_FEENABLEEXCEPT)
endif()
if(NOT DEFINED HAVE_FEENABLEEXCEPT)
set(HAVE_FEENABLEEXCEPT 0)
endif()
# Used for: `source/blender/blenlib/intern/system.c`.
# `execinfo` is not available on non-GLIBC systems (at least not on MUSL-LIBC),
# so check the presence of the header before including it and using the it for back-trace.
set(HAVE_EXECINFO_H OFF)
if(NOT MSVC)
include(CheckIncludeFiles)
check_include_files("execinfo.h" HAVE_EXECINFO_H)
@ -32,3 +33,6 @@ if(NOT MSVC)
add_definitions(-DHAVE_EXECINFO_H)
endif()
endif()
if(NOT DEFINED HAVE_EXECINFO_H)
set(HAVE_EXECINFO_H 0)
endif()