diff --git a/Testing/Code/Wrappers/CMakeLists.txt b/Testing/Code/Wrappers/CMakeLists.txt
index fc6dd63afed1727ea9b381b5c38af3ca1ac13d31..8eb78cc1af78d4e182ba9b6fdf5c43bc814a05d1 100644
--- a/Testing/Code/Wrappers/CMakeLists.txt
+++ b/Testing/Code/Wrappers/CMakeLists.txt
@@ -10,7 +10,7 @@ if ( OTB_WRAP_JAVA )
   add_subdirectory(Java)
 endif ()
 
-if ( OTB_WRAP_QT )
+if ( OTB_WRAP_QT AND OTB_USE_VISU_GUI )
   add_subdirectory(Qt)
 endif ()