Skip to content

Commit 3527e83

Browse files
authored
[libunwind] Introduce LIBUNWIND_LIBRARY_VERSION and drop outdated Apple flags (#110178)
This patch introduces the LIBUNWIND_LIBRARY_VERSION setting to control the dylib version of libunwind. This allows expressing the dylib version in CMake instead of adding custom compiler flags. As a drive-by, also remove some outdated Apple flags that are not relevant anymore.
1 parent 49d9334 commit 3527e83

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

libunwind/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ cmake_dependent_option(LIBUNWIND_INSTALL_SHARED_LIBRARY
6161
"Install the shared libunwind library." ON
6262
"LIBUNWIND_ENABLE_SHARED;LIBUNWIND_INSTALL_LIBRARY" OFF)
6363

64+
set(LIBUNWIND_LIBRARY_VERSION "1.0" CACHE STRING
65+
"Version of libunwind. This will be reflected in the name of the shared library produced.
66+
For example, -DLIBUNWIND_LIBRARY_VERSION=x.y will result in the library being named
67+
libunwind.x.y.dylib, along with the usual symlinks pointing to that. On Apple platforms,
68+
this also controls the linker's 'current_version' property.")
69+
6470
if(MINGW)
6571
set(LIBUNWIND_DEFAULT_TEST_CONFIG "llvm-libunwind-mingw.cfg.in")
6672
elseif (LIBUNWIND_ENABLE_SHARED)

libunwind/src/CMakeLists.txt

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,6 @@ if (LIBUNWIND_ENABLE_SHARED AND
105105
"on C++ ABI library is not supported.")
106106
endif()
107107

108-
if (APPLE)
109-
add_compile_flags("-U__STRICT_ANSI__")
110-
add_link_flags("-compatibility_version 1" "-install_name /usr/lib/libunwind.1.dylib")
111-
112-
if (CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6")
113-
add_link_flags("-current_version ${LIBUNWIND_VERSION}" "/usr/lib/libSystem.B.dylib")
114-
endif ()
115-
endif ()
116-
117108
if (HAIKU)
118109
add_library_flags_if(LIBUNWIND_HAS_ROOT_LIB root)
119110

@@ -170,8 +161,8 @@ if (LIBUNWIND_ENABLE_SHARED)
170161
LINK_FLAGS "${LIBUNWIND_LINK_FLAGS}"
171162
LINKER_LANGUAGE C
172163
OUTPUT_NAME "${LIBUNWIND_SHARED_OUTPUT_NAME}"
173-
VERSION "1.0"
174-
SOVERSION "1"
164+
VERSION "${LIBUNWIND_LIBRARY_VERSION}"
165+
SOVERSION "1"
175166
)
176167

177168
list(APPEND LIBUNWIND_BUILD_TARGETS "unwind_shared")

0 commit comments

Comments
 (0)