From d7c5484a3df32af9a6d56a53ec991b4eae6faebe Mon Sep 17 00:00:00 2001 From: Andy Galasso Date: Sat, 4 Jan 2025 15:14:09 -0500 Subject: [PATCH] Linux: update phd2.sh to use CMAKE_INSTALL_PREFIX (#1281) Allows `make install` run with a CMAKE_INSTALL_PREFIX other than the default (`/usr`) to generate a phd2.sh with the matching install prefix. --- cmake_modules/PHD2Packaging.cmake | 3 ++- phd2.sh | 3 --- phd2.sh.in | 3 +++ 3 files changed, 5 insertions(+), 4 deletions(-) delete mode 100755 phd2.sh create mode 100755 phd2.sh.in diff --git a/cmake_modules/PHD2Packaging.cmake b/cmake_modules/PHD2Packaging.cmake index 0f5740f7d..82f5b89da 100644 --- a/cmake_modules/PHD2Packaging.cmake +++ b/cmake_modules/PHD2Packaging.cmake @@ -68,7 +68,8 @@ endif() if(UNIX AND NOT APPLE) install(TARGETS phd2 RUNTIME DESTINATION bin) - install(PROGRAMS phd2.sh + configure_file(phd2.sh.in phd2.sh @ONLY) + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/phd2.sh DESTINATION bin RENAME phd2) install(FILES ${PHD_INSTALL_LIBS} diff --git a/phd2.sh b/phd2.sh deleted file mode 100755 index 5ed51bca0..000000000 --- a/phd2.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -export LD_LIBRARY_PATH="/usr/lib/phd2${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" -exec "$0.bin" "$@" diff --git a/phd2.sh.in b/phd2.sh.in new file mode 100755 index 000000000..1e13e56d4 --- /dev/null +++ b/phd2.sh.in @@ -0,0 +1,3 @@ +#!/bin/sh +export LD_LIBRARY_PATH="@CMAKE_INSTALL_PREFIX@/lib/phd2${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" +exec "$0.bin" "$@"