Skip to content

Commit

Permalink
Merge pull request #332 from rest-for-physics/lobis-thisREST-zsh
Browse files Browse the repository at this point in the history
fix source geant4 from thisREST on zsh shell
  • Loading branch information
lobis authored Nov 21, 2022
2 parents 5c5291e + cb7d66a commit 827b2a9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmake/thisREST.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ execute_process(COMMAND geant4-config --prefix
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
OUTPUT_VARIABLE GEANT4_PATH)
string(REGEX REPLACE "\n$" "" GEANT4_PATH "${GEANT4_PATH}")
set(thisGeant4 "${GEANT4_PATH}/bin/geant4.sh")
get_filename_component(GEANT4_BIN_DIR "${GEANT4_PATH}/bin/" REALPATH)

if (${REST_G4} MATCHES "ON")
set(loadG4 "\# if geant4.sh script is found we load the same Geant4 version as used in compilation\nif [[ -f \\\"${thisGeant4}\\\" ]]; then
source ${thisGeant4}\nfi\n")
# https://github.com/rest-for-physics/framework/issues/331
set(loadG4 "\# if geant4.sh script is found we load the same Geant4 version as used in compilation\nif [[ -f \\\"${GEANT4_BIN_DIR}/geant4.sh\\\" ]]; then
[[ -n \\\"\\\${ZSH_VERSION}\\\" ]] && pushd ${GEANT4_BIN_DIR} > /dev/null\n source ${GEANT4_BIN_DIR}/geant4.sh\n [[ -n \\\"\\\${ZSH_VERSION}\\\" ]] && popd > /dev/null\nfi\n")
else ()
set(loadG4 "")
endif (${REST_G4} MATCHES "ON")
Expand Down

0 comments on commit 827b2a9

Please sign in to comment.