summaryrefslogtreecommitdiffstats
path: root/cmake/QtBuild.cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-02-24 16:52:36 +0100
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-02-25 15:43:16 +0100
commit1b474118326d0cc7a69b20d22d1e52d9ed42c07e (patch)
tree23145a30dcc3734f9253ce5f1f9fbef78dffda60 /cmake/QtBuild.cmake
parent173079819d6dc57145bbbcc03c0d93726c2176fc (diff)
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 <simon.hausmann@qt.io> Reviewed-by: Leander Beernaert <leander.beernaert@qt.io>
Diffstat (limited to 'cmake/QtBuild.cmake')
-rw-r--r--cmake/QtBuild.cmake8
1 files changed, 7 insertions, 1 deletions
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 "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
- 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
"$<BUILD_INTERFACE:${module_include_dir}/${PROJECT_VERSION}>"
"$<BUILD_INTERFACE:${module_include_dir}/${PROJECT_VERSION}/${module}>")