diff --git a/MeshLib/IO/writeMeshToFile.cpp b/MeshLib/IO/writeMeshToFile.cpp
index 550c033c4bd152199c9a480e898fd91ce3631855..93cd00798312925e4d05b01e8b087dc7b3b55581 100644
--- a/MeshLib/IO/writeMeshToFile.cpp
+++ b/MeshLib/IO/writeMeshToFile.cpp
@@ -14,7 +14,9 @@
 #include "BaseLib/StringTools.h"
 #include "MeshLib/IO/Legacy/MeshIO.h"
 #include "MeshLib/IO/VtkIO/VtuInterface.h"
+#ifdef OGS_USE_XDMF
 #include "MeshLib/IO/XDMF/XdmfHdfWriter.h"
+#endif
 #include "MeshLib/Mesh.h"
 
 namespace MeshLib::IO
diff --git a/ProcessLib/Output/ProcessOutput.cpp b/ProcessLib/Output/ProcessOutput.cpp
index 6990726e52746ab0242405bfa93f3752f1f3bb49..f223937c5c4a62210d645846375faeaf21c82639 100644
--- a/ProcessLib/Output/ProcessOutput.cpp
+++ b/ProcessLib/Output/ProcessOutput.cpp
@@ -23,7 +23,6 @@
 #include "MeshLib/NodePartitionedMesh.h"
 #endif
 #include "MeshLib/IO/VtkIO/VtuInterface.h"
-#include "MeshLib/IO/XDMF/XdmfHdfWriter.h"
 #include "NumLib/DOF/LocalToGlobalIndexMap.h"
 
 /// Copies the ogs_version string containing the release number and the git
@@ -316,7 +315,6 @@ void makeOutput(std::string const& file_name, MeshLib::Mesh const& mesh,
 #endif                     //_WIN32
 #endif                     //__APPLE__
 
-
     MeshLib::IO::VtuInterface vtu_interface(&mesh, data_mode, compress_output);
     vtu_interface.writeToFile(file_name);