Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save eblot/64d73fbb14f865bb351d5dd161033210 to your computer and use it in GitHub Desktop.
Save eblot/64d73fbb14f865bb351d5dd161033210 to your computer and use it in GitHub Desktop.
Libunwind w/ static linkage (adapter from Yves Delley's)
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index b38973b0b17..a06c9cba498 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -84,9 +84,11 @@ if (LIBCXXABI_USE_LLVM_UNWINDER)
if (NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY AND (TARGET unwind_shared OR HAVE_LIBUNWIND))
list(APPEND LIBCXXABI_STATIC_LIBRARIES unwind_shared)
elseif (LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY AND (TARGET unwind_static OR HAVE_LIBUNWIND))
- # We handle this by directly merging libunwind objects into libc++abi.
+ # We handle this by directly merging libunwind objects into libc++abi.
+ set(LIBUNWIND_STATIC_LIBRARY_FILE "$<TARGET_LINKER_FILE:unwind_static>")
else()
list(APPEND LIBCXXABI_STATIC_LIBRARIES unwind)
+ set(LIBUNWIND_STATIC_LIBRARY_FILE libunwind.a ${LIBCXXABI_LIBUNWIND_LINK_FLAGS})
endif()
else()
add_library_flags_if(LIBCXXABI_HAS_GCC_S_LIB gcc_s)
@@ -264,7 +266,7 @@ if (LIBCXXABI_ENABLE_STATIC)
--ar "${CMAKE_AR}"
${MERGE_ARCHIVES_LIBTOOL}
"$<TARGET_LINKER_FILE:cxxabi_static>"
- "$<TARGET_LINKER_FILE:unwind_static>"
+ ${LIBUNWIND_STATIC_LIBRARY_FILE}
WORKING_DIRECTORY ${LIBCXXABI_BUILD_DIR}
)
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment