CMakeLists.txt: Assume CMAKE_INSTALL_RPATH for packaging

CPack does not install to CMAKE_INSTALL_PREFIX, but
CPACK_PACKAGING_INSTALL_PREFIX. However, the executables' rpath
would still be configured for ${CMAKE_INSTALL_PREFIX}/${SD_LIBDIR}/lib
instead of ${CPACK_PACKAGING_INSTALL_PREFIX}/${SD_LIBDIR}/lib,
making executables to fail to find their respective shared libraries.

Unfortunately, CPACK_PACKAGING_INSTALL_PREFIX is not defined by CMake,
but CPack, so it is not available from this context, so this commit
assumes its default value. [1]

[1]: https://cmake.org/cmake/help/latest/variable/CPACK_PACKAGING_INSTALL_PREFIX.html
This commit is contained in:
Xavier Del Campo Romero 2025-01-17 06:41:04 +01:00
parent 195f223d5f
commit 6df4b6bf98
Signed by: xavi
GPG key ID: 84FF3612A9BF43F2

View file

@ -86,6 +86,7 @@ INCLUDE(cmake/checks.cmake)
set(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_RPATH}
${CMAKE_INSTALL_PREFIX}/${SD_LIBDIR}/lib
/usr/${SD_LIBDIR}/lib
)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)