From cb05cbc1a71cc95e47d6e5ebad467f9ba2f69fcb Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 5 Jan 2018 10:12:15 -0500 Subject: [PATCH] Properly find MPI and setup DIY when CMake >= 3.10 --- CMakeLists.txt | 3 +++ diy/CMakeLists.txt | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e2ac4a0a..0e894fb5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -203,6 +203,9 @@ check_type_size("long long" VTKm_SIZE_LONG_LONG BUILTIN_TYPES_ONLY) if(VTKm_ENABLE_MPI) # This `if` is temporary and will be removed once `diy` supports building # without MPI. + if (NOT MPI_C_FOUND) + find_package(MPI ${VTKm_FIND_PACKAGE_QUIETLY}) + endif() add_subdirectory(diy) endif() add_subdirectory(vtkm) diff --git a/diy/CMakeLists.txt b/diy/CMakeLists.txt index 8b7d71f17..bc902691c 100644 --- a/diy/CMakeLists.txt +++ b/diy/CMakeLists.txt @@ -33,8 +33,11 @@ target_include_directories(diy INTERFACE $) # presently, this dependency is required. Make it optional in the future. +# CMake 3.10 FindMPI removed MPI_<>_INCLUDE_PATH and replaced them with the +# MPI_<>_INCLUDE_DIRS so the FindMPI conforms to CMake find module requirements set(arg) -foreach(apath IN LISTS MPI_C_INCLUDE_PATH MPI_CXX_INCLUDE_PATH) +foreach(apath IN LISTS MPI_C_INCLUDE_PATH MPI_CXX_INCLUDE_PATH + MPI_C_INCLUDE_DIRS MPI_CXX_INCLUDE_DIRS) list(APPEND arg $) endforeach() target_include_directories(diy INTERFACE ${arg})