build: support build with libunwind on osx (#162)

macOS provides a libunwind in SDK, so we can skip the library search
process.

---------

Co-authored-by: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com>
This commit is contained in:
lzw 2024-08-31 07:15:38 +08:00 committed by GitHub
parent 231960d472
commit f671819510
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -523,6 +523,7 @@ if(CPPTRACE_UNWIND_WITH_LIBUNWIND)
endif()
endif()
if(NOT libunwind_FOUND)
if (NOT APPLE)
# set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
# set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS ON)
find_path(LIBUNWIND_INCLUDE_DIRS NAMES "libunwind.h")
@ -543,6 +544,7 @@ if(CPPTRACE_UNWIND_WITH_LIBUNWIND)
target_compile_options(${target_name} PRIVATE ${LIBUNWIND_CFLAGS_OTHER})
target_include_directories(${target_name} PRIVATE ${LIBUNWIND_INCLUDE_DIRS})
target_link_libraries(${target_name} PRIVATE ${LIBUNWIND_LDFLAGS})
endif()
target_compile_definitions(${target_name} PUBLIC CPPTRACE_UNWIND_WITH_LIBUNWIND UNW_LOCAL_ONLY)
endif()
endif()