diff --git a/Applications/Utils/Tests.cmake b/Applications/Utils/Tests.cmake
index 975093d7b68a8758c0000c3dd1ad9910c3a9fa5a..b04c7906df9f20930803ebffbed81feeda712c4b 100644
--- a/Applications/Utils/Tests.cmake
+++ b/Applications/Utils/Tests.cmake
@@ -478,15 +478,18 @@ AddTest(
               SmallTest_Layer3.vtu
 )
 
-AddTest(
-    NAME VerticalSliceFromLayers_Test
-    PATH MeshGeoToolsLib/Ammer
-    WORKING_DIRECTORY ${Data_SOURCE_DIR}/MeshGeoToolsLib/Ammer
-    EXECUTABLE VerticalSliceFromLayers
-    EXECUTABLE_ARGS -i AmmerLayers.txt -o ${Data_BINARY_DIR}/MeshGeoToolsLib/Ammer/AmmerSlice --start-x 3491000 --start-y 5380000 --end-x 3495000 --end-y 5385000 -r 200
-    REQUIREMENTS NOT OGS_USE_MPI
-    DIFF_DATA AmmerSlice.vtu AmmerSlice.vtu 1e-16
-)
+# Utility requires that GUI is build because it uses Qt-based functionality
+if(TARGET VerticalSliceFromLayers)
+    AddTest(
+        NAME VerticalSliceFromLayers_Test
+        PATH MeshGeoToolsLib/Ammer
+        WORKING_DIRECTORY ${Data_SOURCE_DIR}/MeshGeoToolsLib/Ammer
+        EXECUTABLE VerticalSliceFromLayers
+        EXECUTABLE_ARGS -i AmmerLayers.txt -o ${Data_BINARY_DIR}/MeshGeoToolsLib/Ammer/AmmerSlice --start-x 3491000 --start-y 5380000 --end-x 3495000 --end-y 5385000 -r 200
+        REQUIREMENTS NOT OGS_USE_MPI
+        DIFF_DATA AmmerSlice.vtu AmmerSlice.vtu 1e-16
+    )
+endif()
 
 AddTest(
     NAME IntegrateBoreholesIntoMesh_MatOnly_Test