diff --git a/Applications/FileIO/CMakeLists.txt b/Applications/FileIO/CMakeLists.txt
index 9f624790b0d428788c030851cfc1bfa72dff0f2d..c83d1009486b8296e85b58f1cc4f84436a5a06c1 100644
--- a/Applications/FileIO/CMakeLists.txt
+++ b/Applications/FileIO/CMakeLists.txt
@@ -28,6 +28,11 @@ target_link_libraries(ApplicationsFileIO
     PRIVATE MeshLib
 )
 
+if(OGS_BUILD_GUI)
+    # Needed for the XmlPrjInterface, which links the DE/Base/OGSError.h.
+    target_link_libraries(ApplicationsFileIO PUBLIC QtBase)
+endif()
+
 if(Shapelib_FOUND)
     target_link_libraries(ApplicationsFileIO PRIVATE ${Shapelib_LIBRARIES})
 endif()