Commit e221039e authored by Keith Ballard's avatar Keith Ballard Committed by Brad King

FindMPI: Improve error when a component's language is not enabled

Previously, if a CMake project requests a component for a language that is
not enabled, it would simply give an error with the message

    Could NOT find MPI (missing: MPI_${LANG}_FOUND)

which is not indicative that the language was not enabled.  This change
provides an error message indicating that it failed to find the
particular MPI component because no compiler was available for the
language and the language might need to be enabled for the project.

Closes: #19996
parent 5f630a93
......@@ -1391,6 +1391,7 @@ 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. ")
endif()
if(_MPI_FIND_${LANG})
if( ${LANG} STREQUAL CXX AND NOT MPICXX IN_LIST MPI_FIND_COMPONENTS )
......@@ -1688,6 +1689,7 @@ endif()
find_package_handle_standard_args(MPI
REQUIRED_VARS ${_MPI_REQ_VARS}
VERSION_VAR ${_MPI_MIN_VERSION}
REASON_FAILURE_MESSAGE "${_MPI_FAIL_REASON}"
HANDLE_COMPONENTS)
#=============================================================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment