mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 03:39:43 -06:00
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
This commit is contained in:
@@ -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)
|
||||
|
||||
#=============================================================================
|
||||
|
||||
Reference in New Issue
Block a user