blob: a3649a5e89539a0461409475a0d910935ed5f03d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# - Try to find libunwind
# Once done this will define
#
# unwind_FOUND - system has libunwind
# unwind - cmake target for libunwind
find_library (UNWIND_LIBRARY NAMES unwind DOC "unwind library")
include (CheckIncludeFile)
check_include_file (unwind.h HAVE_UNWIND_H)
if (NOT HAVE_UNWIND_H)
check_include_file (libunwind.h HAVE_UNWIND_H)
endif ()
if (CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
set(LIBUNWIND_ARCH "arm")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64")
set(LIBUNWIND_ARCH "aarch64")
elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64" OR
CMAKE_SYSTEM_PROCESSOR STREQUAL "corei7-64")
set(LIBUNWIND_ARCH "x86_64")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
set(LIBUNWIND_ARCH "x86")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64")
set(LIBUNWIND_ARCH "ppc64")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc")
set(LIBUNWIND_ARCH "ppc32")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
set(LIBUNWIND_ARCH "mips")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^hppa")
set(LIBUNWIND_ARCH "hppa")
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^ia64")
set(LIBUNWIND_ARCH "ia64")
endif()
if (UNWIND_LIBRARY MATCHES "_FOUND")
set(UNWIND_LIBRARY unwind)
set(HAVE_UNWIND_LIB ON)
else()
find_library (UNWIND_LIBRARY NAMES "unwind-${LIBUNWIND_ARCH}" DOC "unwind library platform")
if (UNWIND_LIBRARY MATCHES "_FOUND")
set(HAVE_UNWIND_LIB ON)
set(UNWIND_LIBRARY unwind-${LIBUNWIND_ARCH})
endif ()
endif()
if (HAVE_UNWIND_LIB AND HAVE_UNWIND_H)
set(unwind_FOUND ON)
elseif(HAVE_UNWIND_H)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64
AND CMAKE_C_COMPILER_ID STREQUAL zig
AND NOT ANDROID
AND NOT IOS)
set(UNWIND_LIBRARY unwind)
set(HAVE_UNWIND_LIB ON)
endif()
else ()
unset(UNWIND_LIBRARY)
endif ()
|