Update cmake policy wrt. RPATH on OSX

Previous settings caused install outside CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
to use install_name "lib/" in place of the expected (and useful) "@rpath/".
This commit is contained in:
Michael Davidsaver 2023-08-01 14:02:34 -07:00 committed by Azat Khuzhin
parent 3c29a81b8b
commit c9ec6aafb6
2 changed files with 6 additions and 1 deletions

View File

@ -21,9 +21,15 @@
cmake_minimum_required(VERSION 3.4 FATAL_ERROR) cmake_minimum_required(VERSION 3.4 FATAL_ERROR)
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH is enabled by default.
endif()
if (POLICY CMP0054) if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW) cmake_policy(SET CMP0054 NEW)
endif() endif()
if (POLICY CMP0068)
cmake_policy(SET CMP0068 NEW) # RPATH settings on macOS do not affect install_name.
endif()
if (POLICY CMP0074) if (POLICY CMP0074)
cmake_policy(SET CMP0074 NEW) cmake_policy(SET CMP0074 NEW)
endif() endif()

View File

@ -140,7 +140,6 @@ macro(add_event_library LIB_NAME)
set_target_properties( set_target_properties(
"${LIB_NAME}_shared" PROPERTIES "${LIB_NAME}_shared" PROPERTIES
OUTPUT_NAME "${LIB_NAME}-${EVENT_PACKAGE_RELEASE}.${CURRENT_MINUS_AGE}" OUTPUT_NAME "${LIB_NAME}-${EVENT_PACKAGE_RELEASE}.${CURRENT_MINUS_AGE}"
INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}"
LINK_FLAGS "-compatibility_version ${COMPATIBILITY_VERSION} -current_version ${COMPATIBILITY_VERSION}.${EVENT_ABI_LIBVERSION_REVISION}") LINK_FLAGS "-compatibility_version ${COMPATIBILITY_VERSION} -current_version ${COMPATIBILITY_VERSION}.${EVENT_ABI_LIBVERSION_REVISION}")
else() else()
math(EXPR CURRENT_MINUS_AGE "${EVENT_ABI_LIBVERSION_CURRENT}-${EVENT_ABI_LIBVERSION_AGE}") math(EXPR CURRENT_MINUS_AGE "${EVENT_ABI_LIBVERSION_CURRENT}-${EVENT_ABI_LIBVERSION_AGE}")