From b71a60d122a5dd0ac2598662da4b059782a1e77f Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Mon, 30 Jul 2018 17:18:32 +0200
Subject: [PATCH] ENH: add whichMpicxx function for C++ programs

---
 etc/tools/ThirdPartyFunctions | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/etc/tools/ThirdPartyFunctions b/etc/tools/ThirdPartyFunctions
index b1558bb..4e468ed 100644
--- a/etc/tools/ThirdPartyFunctions
+++ b/etc/tools/ThirdPartyFunctions
@@ -89,15 +89,33 @@ whichMpicc()
     local mpicc=$(command -v mpicc)
     case "$WM_MPLIB" in
     (INTELMPI)
-        mpicc=$(command -v mpiicc)  # Intel <mpiicc> available?
+        mpicc=$(command -v mpiicc)      # Intel <mpiicc> available?
         ;;
     (CRAY-MPI*)
-        : ${mpicc:=cc}              # Cray <cc> if there is no <mpicc>
+        : ${mpicc:=cc}                  # Cray <cc> if there is no <mpicc>
         ;;
     esac
     echo "${mpicc:-mpicc}"
 }
 
+
+# Return <mpicc> by default or <mpiicc> if possible for INTELMPI.
+# Cray doesn't have <mpicc>, but its <cc> manages mpi paths directly.
+# NOTE: could further refine based on $CC or $WM_CC, but not yet needed
+whichMpicxx()
+{
+    local mpicxx=$(command -v mpicxx)
+    case "$WM_MPLIB" in
+    (INTELMPI)
+        mpicxx=$(command -v mpiicpc)    # Intel <mpiicpc> available?
+        ;;
+    (CRAY-MPI*)
+        : ${mpicxx:=CC}                 # Cray <CC> if there is no <mpicc>
+        ;;
+    esac
+    echo "${mpicxx:-mpicxx}"
+}
+
 # The presence of wmkdep etc required for building with wmake
 requireWMakeToolchain()
 {
-- 
GitLab