From f9842ae7d481cf5df08a000c4af7822d1bee0dd7 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 2 Sep 2019 11:26:12 +0200 Subject: [PATCH] Don't include module syncqt header locations if syncqt was not run When building QtQmlDevTools we don't generate syncqt headers, but the non-existent include paths were still added, which means that anything that used QtQmlDevTools would fail to configure (the standalone tests). Make sure to only add the include paths if syncqt was executed. Change-Id: I6d79ecf53e9a5d396e8df801584ce2c9f119f9be Reviewed-by: Simon Hausmann Reviewed-by: Qt CMake Build Bot --- cmake/QtBuild.cmake | 44 +++++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 6699e9844c0..3a1a6ebaec2 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1295,16 +1295,23 @@ function(add_qt_module target) set(private_includes "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}" - "${module_include_dir}/${PROJECT_VERSION}" - "${module_include_dir}/${PROJECT_VERSION}/${module}" ${arg_INCLUDE_DIRECTORIES} ) - set(public_includes - # For the syncqt headers - "$" - "$" - ) + set(public_includes "") + + # Handle cases like QmlDevTools which do not have their own headers, but rather borrow them + # from another module. + if(NOT arg_NO_SYNC_QT) + list(APPEND private_includes + "${module_include_dir}/${PROJECT_VERSION}" + "${module_include_dir}/${PROJECT_VERSION}/${module}") + + list(APPEND public_includes + # For the syncqt headers + "$" + "$") + endif() if(NOT arg_NO_MODULE_HEADERS) # For the syncqt headers @@ -1501,19 +1508,22 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})") qt_internal_add_link_flags_no_undefined("${target}") endif() - set(interface_includes - "$" - "$" - "$" - ) + set(interface_includes "") - if(NOT arg_NO_MODULE_HEADERS) + # Handle cases like QmlDevTools which do not have their own headers, but rather borrow them + # from another module. + if(NOT arg_NO_SYNC_QT) list(APPEND interface_includes - "$" - "$" - ) - endif() + "$" + "$" + "$") + if(NOT arg_NO_MODULE_HEADERS) + list(APPEND interface_includes + "$" + "$") + endif() + endif() if(NOT ${arg_NO_PRIVATE_MODULE}) target_include_directories("${target_private}" INTERFACE ${interface_includes})