From d1bd7573cb592f0c7fecc8a273fe429f32c36934 Mon Sep 17 00:00:00 2001 From: Vicente Adolfo Bolea Sanchez Date: Mon, 18 Nov 2024 15:02:08 -0500 Subject: [PATCH] cmake: refactor generate-adios2-config.sh --- .../install/post/generate-adios2-config.sh.in | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/cmake/install/post/generate-adios2-config.sh.in b/cmake/install/post/generate-adios2-config.sh.in index a789810da4..bbe4f7ab00 100755 --- a/cmake/install/post/generate-adios2-config.sh.in +++ b/cmake/install/post/generate-adios2-config.sh.in @@ -4,6 +4,8 @@ unset MAKEFLAGS unset MAKE +declare PREFIX + function make_target_flags() { local tgt=$1 sleep 1 @@ -58,21 +60,17 @@ function prefixify() { echo "$@" | sed "s|${PREFIX}|\${ADIOS2_PREFIX}|g" } -PREFIX="$1" +########################################################################### +# Main +arg_prefix="$1" -if [ "${1:0:1}" != "/" ] +# Prefix should be an absolute path, but if it's not, make it absolute +if [ "${arg_prefix:0:1}" != "/" ] then - # Convert relative paths to absolute based on DESTDIR - PREFIX="${DESTDIR:-$(pwd)}/$1" -else - # Check if the DESTDIR directory exists and prepend it to PREFIX - if [ -d "${DESTDIR}" ] - then - PREFIX="${DESTDIR}$1" - fi + PREFIX="$PWD/$arg_prefix" fi -shift +PREFIX="${DESTDIR}${arg_prefix}" CMAKE="@CMAKE_COMMAND@" SOURCE_DIR="@ADIOS2_SOURCE_DIR@/cmake/install/post/adios2-config-dummy"