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:
parent
231960d472
commit
f671819510
@ -523,26 +523,28 @@ if(CPPTRACE_UNWIND_WITH_LIBUNWIND)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
if(NOT libunwind_FOUND)
|
if(NOT libunwind_FOUND)
|
||||||
# set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
|
if (NOT APPLE)
|
||||||
# set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS ON)
|
# set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
|
||||||
find_path(LIBUNWIND_INCLUDE_DIRS NAMES "libunwind.h")
|
# set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS ON)
|
||||||
find_library(LIBUNWIND NAMES unwind libunwind libunwind8 libunwind.so.8 REQUIRED PATHS "/usr/lib/x86_64-linux-gnu/")
|
find_path(LIBUNWIND_INCLUDE_DIRS NAMES "libunwind.h")
|
||||||
if(LIBUNWIND)
|
find_library(LIBUNWIND NAMES unwind libunwind libunwind8 libunwind.so.8 REQUIRED PATHS "/usr/lib/x86_64-linux-gnu/")
|
||||||
set(libunwind_FOUND TRUE)
|
if(LIBUNWIND)
|
||||||
|
set(libunwind_FOUND TRUE)
|
||||||
|
endif()
|
||||||
|
if(NOT libunwind_FOUND)
|
||||||
|
# message(FATAL_ERROR "Unable to locate libunwind")
|
||||||
|
# Try to link with it if it's where it should be
|
||||||
|
# This path can be entered if libunwind was installed via the system package manager, sometimes. I probably messed
|
||||||
|
# up the find_library above.
|
||||||
|
set(LIBUNWIND_LDFLAGS "-lunwind")
|
||||||
|
endif()
|
||||||
|
if(NOT LIBUNWIND_LDFLAGS)
|
||||||
|
set(LIBUNWIND_LDFLAGS "${LIBUNWIND}")
|
||||||
|
endif()
|
||||||
|
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()
|
endif()
|
||||||
if(NOT libunwind_FOUND)
|
|
||||||
# message(FATAL_ERROR "Unable to locate libunwind")
|
|
||||||
# Try to link with it if it's where it should be
|
|
||||||
# This path can be entered if libunwind was installed via the system package manager, sometimes. I probably messed
|
|
||||||
# up the find_library above.
|
|
||||||
set(LIBUNWIND_LDFLAGS "-lunwind")
|
|
||||||
endif()
|
|
||||||
if(NOT LIBUNWIND_LDFLAGS)
|
|
||||||
set(LIBUNWIND_LDFLAGS "${LIBUNWIND}")
|
|
||||||
endif()
|
|
||||||
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})
|
|
||||||
target_compile_definitions(${target_name} PUBLIC CPPTRACE_UNWIND_WITH_LIBUNWIND UNW_LOCAL_ONLY)
|
target_compile_definitions(${target_name} PUBLIC CPPTRACE_UNWIND_WITH_LIBUNWIND UNW_LOCAL_ONLY)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user