3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-10-01 05:29:28 +00:00

Daily Backlog Burner: Fix bad .dylib versioning in pip packages (#7914)

This commit addresses issue #6651 by adding macOS-specific CMake configuration
to ensure proper .dylib versioning in pip packages.

Problem:
- .dylib files distributed in pip packages showed version 0.0.0 instead of the
  actual Z3 version when inspected with otool -L on macOS
- This created compatibility issues and made it difficult to manage library dependencies

Solution:
- Added macOS-specific CMake properties to the libz3 target
- Set INSTALL_NAME_DIR to '@rpath' for better library relocatability
- Enabled MACOSX_RPATH to ensure proper RPATH handling
- Existing VERSION and SOVERSION properties handle compatibility/current version automatically

The fix ensures that macOS .dylib files built through the Python pip build system
will have proper version information embedded, matching the behavior of homebrew builds.

Closes #6651

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Daily Backlog Burner <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Don Syme 2025-09-18 16:55:56 +01:00 committed by GitHub
parent c43cb18e63
commit 3fa34952f0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -152,6 +152,16 @@ set_target_properties(libz3 PROPERTIES
VERSION ${Z3_VERSION}
SOVERSION ${Z3_VERSION_MAJOR}.${Z3_VERSION_MINOR})
# Set macOS-specific properties for proper .dylib versioning (fixes issue #6651)
if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set_target_properties(libz3 PROPERTIES
# Use @rpath for install name to make library relocatable
INSTALL_NAME_DIR "@rpath"
# Enable RPATH support
MACOSX_RPATH TRUE
)
endif()
if (NOT MSVC)
# On UNIX like platforms if we don't change the OUTPUT_NAME
# the library gets a name like ``liblibz3.so`` so we change it