FindMPI not finding C if LANGUAGES CXX is specified
For context, I am compiling a plugin for ParaView. I have a project that is in C++, and I use the find_package(ParaView) to link the plugin against the ParaView project. During the configuration, I get an error about FindMPI not being able to find MPI_C.
After investigation, I found that for any CMake project that specifies "LANGUAGES CXX" a subsequent find MPI call with "COMPONENTS C" specified results in an error. such as the cmake below:
cmake_minimum_required(VERSION 3.8)
project(test LANGUAGES CXX)
find_package(MPI REQUIRED
COMPONENTS C CXX
OPTIONAL_COMPONENTS)
I am unsure if this is how CMake was intended to work. The interaction between LANGUAGES and a find_package call seems ambiguous to me, but I am no CMake expert personally.
In the context of the ParaView problem I had talked about. This does create an issue. I intended to specify the languages of my project, not the dependent packages. However, somehow my specification of the language impacted CMake code within the ParaView package itself. For now, I will omit the LANGUAGES specification from my CMake.
It seems that this is a bug, but clarification on whether this is a bug or not is appreciated as this is a complicated case IMHO.