diff options
author | Keith Ballard <keith.m.ballard@gmail.com> | 2019-11-20 14:34:40 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-11-20 15:23:33 (GMT) |
commit | e221039e11fb4961b8cbbdbd2fd8f1af99534893 (patch) | |
tree | a85d84aa6e80047ba8bcb7468fbeb3c7ec4fe3b7 | |
parent | 5f630a934aa4b8616aa59988ea70c14065d3a08d (diff) | |
download | CMake-e221039e11fb4961b8cbbdbd2fd8f1af99534893.zip CMake-e221039e11fb4961b8cbbdbd2fd8f1af99534893.tar.gz CMake-e221039e11fb4961b8cbbdbd2fd8f1af99534893.tar.bz2 |
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
-rw-r--r-- | Modules/FindMPI.cmake | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index 2779032..6b1da4b 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -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) #============================================================================= |