Browse Source

Merge topic 'FindMPI-lang-reason' into release-3.20

8251b62ba0 FindMPI: Fix reason for a non-enabled non-requested language

Acked-by: Kitware Robot <[email protected]>
Merge-request: !5801
Brad King 4 years ago
parent
commit
a86cd9cb3c
1 changed files with 3 additions and 1 deletions
  1. 3 1
      Modules/FindMPI.cmake

+ 3 - 1
Modules/FindMPI.cmake

@@ -1428,7 +1428,9 @@ foreach(LANG IN ITEMS C CXX Fortran)
     endif()
   else()
     set(_MPI_FIND_${LANG} FALSE)
-    string(APPEND _MPI_FAIL_REASON "MPI component '${LANG}' was requested, but language ${LANG} is not enabled.  ")
+    if(${LANG} IN_LIST MPI_FIND_COMPONENTS)
+      string(APPEND _MPI_FAIL_REASON "MPI component '${LANG}' was requested, but language ${LANG} is not enabled.  ")
+    endif()
   endif()
   if(_MPI_FIND_${LANG})
     if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS )