Properly find MPI and setup DIY when CMake >= 3.10

This commit is contained in:
Robert Maynard 2018-01-05 10:12:15 -05:00
parent 4a09615000
commit cb05cbc1a7
2 changed files with 7 additions and 1 deletions

@ -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)

@ -33,8 +33,11 @@ target_include_directories(diy INTERFACE
$<INSTALL_INTERFACE:${VTKm_INSTALL_INCLUDE_DIR}>)
# 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 $<BUILD_INTERFACE:${apath}>)
endforeach()
target_include_directories(diy INTERFACE ${arg})