From 1b474118326d0cc7a69b20d22d1e52d9ed42c07e Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Mon, 24 Feb 2020 16:52:36 +0100 Subject: [PATCH] CMake: Check for syncqt private headers directory before using Only existing directory paths should be added to INTERFACE_INCLUDE_DIRECTORIES, otherwise projects fail to configure. If after running syncqt there is no private headers directory created (due to the module not having any _p.h files), such a path should not be added as an interface include path. This fixes consumers of QtZlib, where there are no private headers. Change-Id: I3fd1a7b5eb8f816d178d6d91223baa6f377e6f9f Reviewed-by: Simon Hausmann Reviewed-by: Leander Beernaert --- cmake/QtBuild.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 48c38f3d8a..4c5a7a6019 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -1978,7 +1978,13 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})") if(NOT arg_NO_SYNC_QT) list(APPEND interface_includes "$") - if(NOT arg_NO_MODULE_HEADERS) + # syncqt.pl does not create a private header directory like 'include/6.0/QtFoo' unless + # the module has foo_p.h header files. For QtZlib, there are no such private headers, so we + # need to make sure not to add such include paths unless the directory exists, otherwise + # consumers of the module will fail at CMake generation time stating that + # INTERFACE_INCLUDE_DIRECTORIES contains a non-existent path. + if(NOT arg_NO_MODULE_HEADERS + AND EXISTS "${module_include_dir}/${PROJECT_VERSION}/${module}") list(APPEND interface_includes "$" "$")