diff --git a/qtxmlpatterns.pro b/qtxmlpatterns.pro
index 6fe9b061b8dc74bc1a8e1b7dfb0e2934a97e50dd..f3bd6fecae3f0e0c7d68c596ca2b8d48b3b8b5b3 100644
--- a/qtxmlpatterns.pro
+++ b/qtxmlpatterns.pro
@@ -14,7 +14,8 @@ module_qtxmlpatterns_examples.depends = module_qtxmlpatterns_src
 module_qtxmlpatterns_tests.subdir = tests
 module_qtxmlpatterns_tests.target = module-qtxmlpatterns-tests
 module_qtxmlpatterns_tests.depends = module_qtxmlpatterns_src
-module_qtxmlpatterns_tests.CONFIG = no_default_target no_default_install
+module_qtxmlpatterns_tests.CONFIG = no_default_install
+!contains(QT_BUILD_PARTS,tests):module_qtxmlpatterns_tests.CONFIG += no_default_target
 
 SUBDIRS += module_qtxmlpatterns_src \
            module_qtxmlpatterns_tools \