Fix MPI build. (#6403)

This commit is contained in:
Jiaming Yuan
2020-11-21 13:38:21 +08:00
committed by GitHub
parent 2ce2a1a4d8
commit 42d31d9dcb
4 changed files with 52 additions and 32 deletions

View File

@@ -78,6 +78,11 @@ if (USE_OPENMP OR USE_CUDA) # CUDA requires OpenMP
target_link_libraries(objxgboost PUBLIC OpenMP::OpenMP_CXX)
endif (USE_OPENMP OR USE_CUDA)
if (RABIT_BUILD_MPI)
find_package(MPI REQUIRED)
target_link_libraries(objxgboost PUBLIC MPI::MPI_CXX)
endif (RABIT_BUILD_MPI)
# For MSVC: Call msvc_use_static_runtime() once again to completely
# replace /MD with /MT. See https://github.com/dmlc/xgboost/issues/4462
# for issues caused by mixing of /MD and /MT flags