diff --git a/MeshLib/IO/VtkIO/VtuInterface-impl.h b/MeshLib/IO/VtkIO/VtuInterface-impl.h
index a14e4cf93eadc84c7786d1d71264db4e4cc677aa..5b0a3df70437cdb6bb63f243987ed91e29d3d784 100644
--- a/MeshLib/IO/VtkIO/VtuInterface-impl.h
+++ b/MeshLib/IO/VtkIO/VtuInterface-impl.h
@@ -82,6 +82,7 @@ bool VtuInterface::writeVTU(std::string const& file_name,
 
     vtuWriter->SetFileName(file_name.c_str());
 
+#ifdef USE_PETSC
     if constexpr (std::is_same_v<UnstructuredGridWriter,
                                  vtkXMLPUnstructuredGridWriter>)
     {
@@ -103,6 +104,7 @@ bool VtuInterface::writeVTU(std::string const& file_name,
         vtuWriter->SetStartPiece(rank);
         vtuWriter->SetEndPiece(rank);
     }
+#endif
 
 #ifdef VTK_USE_64BIT_IDS
     vtuWriter->SetHeaderTypeToUInt64();
diff --git a/scripts/cmake/DependenciesExternalProject.cmake b/scripts/cmake/DependenciesExternalProject.cmake
index b4ed6349b5bb1157c718e9e6d8a8ee344772b7ca..9d3f4de6d25fc8598aa605b8d4a6718550ffdb9f 100644
--- a/scripts/cmake/DependenciesExternalProject.cmake
+++ b/scripts/cmake/DependenciesExternalProject.cmake
@@ -57,7 +57,6 @@ if(OGS_USE_MFRONT)
                 "ExternalProject_Add(): added package TFEL@rliv-${ogs.minimum_version.tfel-rliv}"
         )
         set(TFELHOME ${PROJECT_BINARY_DIR}/_ext/TFEL CACHE PATH "" FORCE)
-        set(_EXT_LIBS ${_EXT_LIBS} TFEL CACHE INTERNAL "")
     endif()
 endif()
 
@@ -249,7 +248,6 @@ if(NOT HDF5_FOUND)
         STATUS
             "ExternalProject_Add(): added package HDF5@${ogs.tested_version.hdf5}"
     )
-    set(_EXT_LIBS ${_EXT_LIBS} HDF5 CACHE INTERNAL "")
     BuildExternalProject_find_package(HDF5)
 endif()
 
@@ -278,9 +276,8 @@ foreach(option_index ${ogs.libraries.vtk.options})
 endforeach()
 list(REMOVE_DUPLICATES VTK_OPTIONS)
 
-# Setting shared libs on PETSc, otherwise pvtu files only contain one
-# <Piece>-element (one subdomain).
-list(APPEND VTK_OPTIONS "-DBUILD_SHARED_LIBS=${OGS_USE_PETSC}"
+# Setting static libs for easier packaging.
+list(APPEND VTK_OPTIONS "-DBUILD_SHARED_LIBS=OFF"
      "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
 )
 message(STATUS "VTK_OPTIONS: ${VTK_OPTIONS}")
@@ -329,7 +326,6 @@ if(NOT VTK_FOUND)
         STATUS
             "ExternalProject_Add(): added package VTK@${ogs.minimum_version.vtk}"
     )
-    set(_EXT_LIBS ${_EXT_LIBS} VTK CACHE INTERNAL "")
     BuildExternalProject_find_package(VTK)
 endif()