diff --git a/etc/settings.csh b/etc/settings.csh
index 4bde0e7ee0e516c59943f3ee66bca89957abd5fc..95fdacd9b25fdb3a5d90552c1ce48fc3704d3067 100644
--- a/etc/settings.csh
+++ b/etc/settings.csh
@@ -121,7 +121,10 @@ case OpenFOAM:
         set gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
         set gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
         set mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
-        set mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
+
+        if ( $?mpc_version ) then
+            set mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
+        endif
 
         # Check that the compiler directory can be found
         if ( ! -d "$gccDir" ) then