diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index a1b044b97d4..6f325adfb48 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1462,9 +1462,12 @@ function(qt_add_module target) # Handle cases like QmlDevTools which do not have their own headers, but rather borrow them # from another module. if(NOT arg_NO_SYNC_QT AND NOT arg_NO_MODULE_HEADERS) - list(APPEND private_includes - "$" - "$") + # Don't include private headers unless they exist, aka syncqt created them. + if(module_headers_private) + list(APPEND private_includes + "$" + "$") + endif() list(APPEND public_includes # For the syncqt headers