Skip to content

Commit 2446b2a

Browse files
authored
macOS: add option to mimic 1.0.0 compatibility version (#709)
As it used to be with autotools. Fixes: #622
1 parent c5ee4d3 commit 2446b2a

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

mac/CMakeLists.txt

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,27 @@ set_target_properties(hidapi_darwin
2121
OUTPUT_NAME "hidapi"
2222
VERSION ${PROJECT_VERSION}
2323
SOVERSION ${PROJECT_VERSION_MAJOR}
24-
MACHO_COMPATIBILITY_VERSION ${PROJECT_VERSION_MAJOR}
2524
FRAMEWORK_VERSION ${PROJECT_VERSION_MAJOR}
2625
PUBLIC_HEADER "${HIDAPI_PUBLIC_HEADERS}"
2726
)
2827

28+
if(NOT CMAKE_VERSION VERSION_LESS 3.17)
29+
option(HIDAPI_USE_LEGACY_COMPATIBILITY_VERSION "Legacy Autotools build system hard-coded 1.0.0 for compatibility version" FALSE)
30+
if(HIDAPI_USE_LEGACY_COMPATIBILITY_VERSION)
31+
# TODO: v1: remove this workaround
32+
set_target_properties(hidapi_darwin
33+
PROPERTIES
34+
MACHO_COMPATIBILITY_VERSION "1.0.0"
35+
MACHO_CURRENT_VERSION "1.0.0"
36+
)
37+
else()
38+
set_target_properties(hidapi_darwin
39+
PROPERTIES
40+
MACHO_COMPATIBILITY_VERSION ${PROJECT_VERSION_MAJOR}
41+
)
42+
endif()
43+
endif()
44+
2945
# compatibility with find_package()
3046
add_library(hidapi::darwin ALIAS hidapi_darwin)
3147
# compatibility with raw library link

0 commit comments

Comments
 (0)