Quick patch for when LIBUNWIND_LDFLAGS isn't set

This commit is contained in:
Jeremy 2024-05-21 22:40:47 -05:00
parent 7c9b24ca72
commit 32275cd679
No known key found for this signature in database
GPG Key ID: 19AA8270105E8EB4

View File

@ -511,18 +511,21 @@ if(CPPTRACE_UNWIND_WITH_LIBUNWIND)
if(LIBUNWIND) if(LIBUNWIND)
set(libunwind_FOUND TRUE) set(libunwind_FOUND TRUE)
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)
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()
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)
endif() endif()
if(CPPTRACE_UNWIND_WITH_EXECINFO) if(CPPTRACE_UNWIND_WITH_EXECINFO)