FindMPI doesn't check whether mpi.h exists in returned include folders
I had a very weird problem just now. This is my CMakeLists.txt
`find_package( MPI REQUIRED )
if( NOT MPI_FOUND ) message( SEND_ERROR "This application cannot compile without MPI" ) endif()
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra" ) # " -O3 -DNDEBUG
include_directories( SYSTEM ${MPI_INCLUDE_PATH} )`
Then in the .cpp to compile I include #include <mpi.h>
. CMake didn't produce any error, but still mpi.h couldn't be found. So I checked the returned folders in MPI_INCLUDE_PATH
and found that the mpi.h actually was in a subfolder, so #include <mpi/mpi.h>
should have worked, but that isn't canon. Well in the end I reinstalled libopenmpi-dev, who knows what got botched up, and then it worked.
My problem is: Even if the build system is weird and not set up correctly CMake should in my opinion check the correctness of the include paths, i.e. check for the existence of mpi.h.