From 31ff9b5c88ab86bee7e410db6862ea0f14eb2fef Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Wed, 26 May 2021 16:48:18 +0200
Subject: [PATCH] [A/U/ModelPreparation] Disable build of non-MPI tools in MPI
 config.

---
 .../Utils/ModelPreparation/CMakeLists.txt     | 18 ++++++------
 .../PartitionMesh/CMakeLists.txt              | 28 ++++++++++---------
 2 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/Applications/Utils/ModelPreparation/CMakeLists.txt b/Applications/Utils/ModelPreparation/CMakeLists.txt
index aa1aaf77c6e..dfd9b2f6f9e 100644
--- a/Applications/Utils/ModelPreparation/CMakeLists.txt
+++ b/Applications/Utils/ModelPreparation/CMakeLists.txt
@@ -1,10 +1,12 @@
-set(TOOLS ComputeNodeAreasFromSurfaceMesh convertVtkDataArrayToVtkDataArray
-          createNeumannBc scaleProperty
-)
-foreach(tool ${TOOLS})
-    ogs_add_executable(${tool} ${tool}.cpp)
-    target_link_libraries(${tool} GitInfoLib MeshLib tclap)
-endforeach()
-install(TARGETS ${TOOLS} RUNTIME DESTINATION bin)
+if(NOT OGS_USE_MPI)
+    set(TOOLS ComputeNodeAreasFromSurfaceMesh convertVtkDataArrayToVtkDataArray
+              createNeumannBc scaleProperty
+    )
+    foreach(tool ${TOOLS})
+        ogs_add_executable(${tool} ${tool}.cpp)
+        target_link_libraries(${tool} GitInfoLib MeshLib tclap)
+    endforeach()
+    install(TARGETS ${TOOLS} RUNTIME DESTINATION bin)
+endif()
 
 add_subdirectory(PartitionMesh)
diff --git a/Applications/Utils/ModelPreparation/PartitionMesh/CMakeLists.txt b/Applications/Utils/ModelPreparation/PartitionMesh/CMakeLists.txt
index c9283a1a825..7d2208f745d 100644
--- a/Applications/Utils/ModelPreparation/PartitionMesh/CMakeLists.txt
+++ b/Applications/Utils/ModelPreparation/PartitionMesh/CMakeLists.txt
@@ -1,14 +1,16 @@
-CPMAddPackage(
-    NAME metis
-    GITHUB_REPOSITORY scibuilder/metis
-    GIT_TAG 982842a5ace9b3da2b2800817eb9e5fd3b42966b
-    DOWNLOAD_ONLY YES
-)
-include(${PROJECT_SOURCE_DIR}/scripts/cmake/MetisSetup.cmake)
+if(NOT OGS_USE_MPI)
+    CPMAddPackage(
+        NAME metis
+        GITHUB_REPOSITORY scibuilder/metis
+        GIT_TAG 982842a5ace9b3da2b2800817eb9e5fd3b42966b
+        DOWNLOAD_ONLY YES
+    )
+    include(${PROJECT_SOURCE_DIR}/scripts/cmake/MetisSetup.cmake)
 
-ogs_add_executable(
-    partmesh PartitionMesh.cpp Metis.cpp NodeWiseMeshPartitioner.cpp
-)
-target_link_libraries(partmesh GitInfoLib MeshLib tclap)
-add_dependencies(partmesh mpmetis)
-install(TARGETS partmesh RUNTIME DESTINATION bin)
+    ogs_add_executable(
+        partmesh PartitionMesh.cpp Metis.cpp NodeWiseMeshPartitioner.cpp
+    )
+    target_link_libraries(partmesh GitInfoLib MeshLib tclap)
+    add_dependencies(partmesh mpmetis)
+    install(TARGETS partmesh RUNTIME DESTINATION bin)
+endif()
-- 
GitLab