From c45ff8cefcaa2fa37202382bccd442df37f97a13 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Sat, 8 Dec 2018 18:01:44 +0100
Subject: [PATCH] BUG: WM_THIRD_PARTY_DIR not set in csh (bug noted in merge
 !222)

- local csh variable in foreach was masking the setenv
---
 etc/config.csh/setup | 11 ++++++-----
 etc/config.csh/unset |  1 +
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/etc/config.csh/setup b/etc/config.csh/setup
index 7f02c0dcb6e..842efd0e6bc 100644
--- a/etc/config.csh/setup
+++ b/etc/config.csh/setup
@@ -45,16 +45,17 @@ source "$WM_PROJECT_DIR/etc/config.csh/functions"
 setenv WM_THIRD_PARTY_DIR
 set foundDir=''
 _foamEcho "Locating ThirdParty directory"
-foreach WM_THIRD_PARTY_DIR (\
+foreach foamDir (\
     "$WM_PROJECT_DIR/ThirdParty" \
     "$prefixDir/ThirdParty-$WM_PROJECT_VERSION" \
     "$prefixDir/ThirdParty-v$WM_PROJECT_API" \
     "$prefixDir/ThirdParty-$WM_PROJECT_API" \
     "$prefixDir/ThirdParty-common" \
 )
-    _foamEcho "... $WM_THIRD_PARTY_DIR"
-    if ( -d "$WM_THIRD_PARTY_DIR" ) then
-        if ( -f "$WM_THIRD_PARTY_DIR/Allwmake" || -d "$WM_THIRD_PARTY_DIR/platforms" ) then
+    _foamEcho "... $foamDir"
+    if ( -d "$foamDir" ) then
+        if ( -f "$foamDir/Allwmake" || -d "$foamDir/platforms" ) then
+            setenv WM_THIRD_PARTY_DIR "$foamDir"
             set foundDir=true
             break
         endif
@@ -182,6 +183,6 @@ unalias _foamAddLib
 unalias _foamAddLibAuto
 
 # Variables (done as final statement for a clean exit code)
-unset cleaned foamOldDirs foundDir prefixDir
+unset cleaned foamOldDirs foundDir foamDir prefixDir
 
 #------------------------------------------------------------------------------
diff --git a/etc/config.csh/unset b/etc/config.csh/unset
index b35cef97ef9..3041f8931a9 100644
--- a/etc/config.csh/unset
+++ b/etc/config.csh/unset
@@ -43,6 +43,7 @@ unsetenv WM_ARCH_OPTION
 unsetenv WM_CC
 unsetenv WM_CFLAGS
 unsetenv WM_COMPILER
+unsetenv WM_COMPILER_ARCH
 unsetenv WM_COMPILER_TYPE
 unsetenv WM_COMPILER_LIB_ARCH
 unsetenv WM_COMPILE_OPTION
-- 
GitLab