[libcxx-commits] [libcxx] [libcxxabi] [libunwind] [unwind, cxx, cxxabi] Fix cmake for static/shared build (PR #176346)
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jan 16 12:23:38 PST 2026
mstorsjo wrote:
It’s possible that a change like this would help here:
```diff
diff --git a/libunwind/src/CMakeLists.txt b/libunwind/src/CMakeLists.txt
index 6e947039fb0d..312c54fbae5a 100644
--- a/libunwind/src/CMakeLists.txt
+++ b/libunwind/src/CMakeLists.txt
@@ -188,6 +188,8 @@ if(LIBUNWIND_HIDE_SYMBOLS)
target_compile_definitions(unwind_static_objects PRIVATE _LIBUNWIND_HIDE_
SYMBOLS)
endif()
+set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+
add_library(unwind_static STATIC)
target_link_libraries(unwind_static PUBLIC unwind_static_objects runtimes-libc-:
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 88ae36e8310f..36fb57287b44 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -304,6 +304,8 @@ if(LIBCXXABI_HERMETIC_STATIC_LIBRARY)
_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS=)
endif()
+set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
+
add_library(cxxabi_static STATIC)
if (LIBCXXABI_USE_LLVM_UNWINDER AND NOT LIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY)
target_link_libraries(cxxabi_static PUBLIC unwind_static runtimes-libc-static)
```
libcxx already does the same, but it hasn’t been needed for libcxxabi and libunwind as those aren’t built in MSVC mode, but it should be harmless for other platforms to do that.
https://github.com/llvm/llvm-project/pull/176346
More information about the libcxx-commits
mailing list