diff --git a/miniapp/CMakeLists.txt b/miniapp/CMakeLists.txt
index a3f8447e62da12d6fc1a489a66d7b4b35d50ec9c..883905caa9a5ffe2ebd6c244ac0565e620ed6a81 100644
--- a/miniapp/CMakeLists.txt
+++ b/miniapp/CMakeLists.txt
@@ -1,7 +1,7 @@
 set(HEADERS
 )
 set(MINIAPP_SOURCES
-    mpi.cpp
+    #    mpi.cpp
     io.cpp
     miniapp.cpp
 )
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 125f99dbf7db9a4900b5f402021e23eb463f1677..5c3ae6c78627d93c78202a6cab72bab1c5d4c621 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -7,6 +7,9 @@ set(BASE_SOURCES
     parameter_list.cpp
     swcio.cpp
 )
+if(${WITH_MPI})
+    set(BASE_SOURCES ${BASE_SOURCES} communication/mpi.cpp)
+endif()
 
 add_library(cellalgo ${BASE_SOURCES} ${HEADERS})
 add_dependencies(cellalgo build_all_mods)
diff --git a/miniapp/mpi.cpp b/src/communication/mpi.cpp
similarity index 100%
rename from miniapp/mpi.cpp
rename to src/communication/mpi.cpp