Skip to content

Commit

Permalink
use variable to set macOS compatible_version (#997)
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Oct 17, 2023
1 parent f96f2fa commit 3168aa0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 3.16.3) # Oldest Ubuntu LTS (20.04 currently)

project(libheif LANGUAGES C CXX VERSION 1.17.0)

# compatibility_version is never allowed to be decreased for any specific SONAME.
# Libtool in the libheif-1.15.1 release had set it to 17.0.0, so we have to use this for the v1.x.y versions.
# With v2.0.0, we can reset this to more closely follow the real version name, i.e. "2.0.0".

This comment has been minimized.

Copy link
@kmilos

kmilos Oct 17, 2023

Contributor

You can't, unfortunately. It forever has to stay >=17.0.0 now.

This comment has been minimized.

Copy link
@farindk

farindk Oct 17, 2023

Author Contributor

I read the docs like that: when we do a new major version, we can reset the compatibility_version because this will in fact be a separate library file.
I.e. v1.x.y library will be libheif.1.dylib and the v2.x.y library will be libheif.2.dylib. Both can be installed in parallel and the compatibility_version is handled independent in both.

This comment has been minimized.

Copy link
@kmilos

kmilos Oct 17, 2023

Contributor

I stand corrected then, I assumed it was the macOS equivalent of soversion.

# CMake 3.17.0 added "MACHO_COMPATIBILITY_VERSION", but we are currently stuck at cmake 3.16.3.
set(MACOS_COMPATIBLE_VERSION "17.0.0")

# https://cmake.org/cmake/help/v3.1/policy/CMP0054.html
cmake_policy(VERSION 3.0...3.22)
include(GNUInstallDirs)
Expand Down
5 changes: 1 addition & 4 deletions libheif/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,10 @@ set_target_properties(heif
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR})

# compatibility_version defaults to 1.0.0 and is never allowed to be
# decreased for any specific SONAME. Libtool in the libheif-1.15.1
# release had set it to 17.0.0, so force it higher here.
if (APPLE)
set_target_properties(heif
PROPERTIES
LINK_FLAGS "-Wl,-compatibility_version,18.0.0")
LINK_FLAGS "-Wl,-compatibility_version,${MACOS_COMPATIBLE_VERSION}")
endif ()

target_compile_definitions(heif
Expand Down

0 comments on commit 3168aa0

Please sign in to comment.