From d3c7e9ef173e009c40629badc3e4522b7314f7ce Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Wed, 30 Jan 2019 09:36:11 +0100
Subject: [PATCH] [CMake] MPI: Use imported target.

---
 SimpleTests/MeshTests/MPI/CMakeLists.txt | 2 +-
 Tests/CMakeLists.txt                     | 2 +-
 scripts/cmake/Find.cmake                 | 1 -
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/SimpleTests/MeshTests/MPI/CMakeLists.txt b/SimpleTests/MeshTests/MPI/CMakeLists.txt
index 09358edbc33..d860bec2028 100644
--- a/SimpleTests/MeshTests/MPI/CMakeLists.txt
+++ b/SimpleTests/MeshTests/MPI/CMakeLists.txt
@@ -13,7 +13,7 @@ if(OGS_USE_PETSC)
 endif()
 
 if(OGS_USE_MPI)
-    target_link_libraries(test_node_partitioned_mesh ${MPI_CXX_LIBRARIES})
+    target_link_libraries(test_node_partitioned_mesh MPI::MPI_CXX)
 endif()
 
 AddTest(
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index bd6f4f0e773..41f20990209 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -58,7 +58,7 @@ if(OGS_USE_PETSC)
 endif()
 
 if(OGS_USE_MPI)
-    target_link_libraries(testrunner ${MPI_CXX_LIBRARIES})
+    target_link_libraries(testrunner MPI::MPI_CXX)
 endif()
 
 if(OGS_BUILD_SWMM)
diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake
index f64f1685ecc..064a7ccfdde 100644
--- a/scripts/cmake/Find.cmake
+++ b/scripts/cmake/Find.cmake
@@ -148,7 +148,6 @@ find_package(OpenSSL)
 ## Check MPI package
 if(OGS_USE_MPI)
     find_package(MPI REQUIRED)
-    include_directories(SYSTEM ${MPI_CXX_INCLUDE_PATH})
 endif()
 
 find_package(Shapelib)
-- 
GitLab