From 7d89a6509b8c4562c6e5e354f3a289b3b1ae61a2 Mon Sep 17 00:00:00 2001
From: Marko Petric <marko.petric@cern.ch>
Date: Wed, 1 Apr 2020 12:28:39 +0200
Subject: [PATCH] add package argument to dd4hep_parse_this

---
 cmake/thisdd4hep.sh            | 9 +++++----
 cmake/thisdd4hep_package.sh.in | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/cmake/thisdd4hep.sh b/cmake/thisdd4hep.sh
index e8dca65a9..43a3a7f9c 100644
--- a/cmake/thisdd4hep.sh
+++ b/cmake/thisdd4hep.sh
@@ -11,13 +11,14 @@
 #-----------------------------------------------------------------------------
 dd4hep_parse_this()   {
     SOURCE=${1}
+    package=${2};
     if [ "x${SOURCE}" = "x" ]; then
-        if [ -f bin/thisdd4hep.sh ]; then
+        if [ -f bin/this${package}.sh ]; then
             THIS="$PWD"; export THIS
-        elif [ -f ./thisdd4hep.sh ]; then
+        elif [ -f ./this${package}.sh ]; then
             THIS=$(cd ..  > /dev/null; pwd); export THIS
         else
-            echo ERROR: must "cd where/dd4hep/is" before calling ". bin/thisdd4hep.sh" for this version of bash!
+            echo ERROR: must "cd where/${package}/is" before calling ". bin/this${package}.sh" for this version of bash!
             THIS=; export THIS
             return 1
         fi
@@ -69,7 +70,7 @@ if [ "x$SOURCE" = "x" ]; then
     SOURCE=${(%):-%N} # for zsh
 fi
 
-dd4hep_parse_this $SOURCE;
+dd4hep_parse_this $SOURCE  @PackageName@;
 #
 # These 3 are the main configuration variables: ROOT, Geant4 and XercesC
 # --> LCIO & Co. are handled elsewhere!
diff --git a/cmake/thisdd4hep_package.sh.in b/cmake/thisdd4hep_package.sh.in
index 4e2ddead5..86385d81b 100644
--- a/cmake/thisdd4hep_package.sh.in
+++ b/cmake/thisdd4hep_package.sh.in
@@ -21,7 +21,7 @@ if [ "x$SOURCE" = "x" ]; then
     SOURCE=${(%):-%N} # for zsh
 fi
 
-dd4hep_parse_this $SOURCE;
+dd4hep_parse_this $SOURCE  @PackageName@;
 #
 #----PATH---------------------------------------------------------------------
 dd4hep_add_path    PATH ${THIS}/bin;
-- 
GitLab