CMakeLists.txt: use CMAKE_INSTALL_FULL_LIBDIR for runpath on darwin

Without the change on systems where `CMAKE_INSTALL_LIBDIR` is an
absolute path outside `CMAKE_INSTALL_PREFIX` (like `nixpkgs`) libraries
ended up embedding wrong RPATH and libraries failed to load.

The change uses suggestion from https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
to use `CMAKE_INSTALL_FULL_LIBDIR` (similar to library install code)
to enbed it as an RPATH.
This commit is contained in:
Sergei Trofimovich 2023-09-17 20:25:01 +01:00
parent 53947c15f5
commit 3ad47114b8
1 changed files with 1 additions and 1 deletions

View File

@ -113,7 +113,7 @@ elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_definitions(-DOS_MACOSX)
set(CMAKE_MACOS_RPATH TRUE)
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_FULL_LIBDIR}")
endif()
if(BROTLI_EMSCRIPTEN)