From 151323b94b20fe2be520e552e995d5e476a788f4 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Fri, 25 Sep 2020 19:48:30 +0200 Subject: CMake: Add $import_prefix/include as an include path for each Qt module To support finding Qt headers of modules installed into a different prefix than the main one, add the $import_prefix/include path as a public include path for each built Qt module. With this, includes like #include will work. The macOS framework case is handled automagically by CMake, which ends up passing '-iframework $import_prefix/lib'. Change-Id: I02ce9cacf157aab9721c1d6073a377607c5b89c7 Fixes: QTBUG-86881 Reviewed-by: Qt CI Bot Reviewed-by: Joerg Bornemann --- cmake/QtModuleHelpers.cmake | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cmake') diff --git a/cmake/QtModuleHelpers.cmake b/cmake/QtModuleHelpers.cmake index a1f7f84b7b..c9ef2397a9 100644 --- a/cmake/QtModuleHelpers.cmake +++ b/cmake/QtModuleHelpers.cmake @@ -297,6 +297,14 @@ function(qt_internal_add_module target) if(NOT arg_NO_MODULE_HEADERS AND NOT arg_NO_SYNC_QT) # For the syncqt headers list(APPEND ${public_headers_list} "$") + + # To support finding Qt module includes that are not installed into the main Qt prefix. + # Use case: A Qt module built by Conan installed into a prefix other than the main prefix. + # This does duplicate the include path set on Qt6::Platform target, but CMake is smart + # enough to deduplicate the include paths on the command line. + # Frameworks are automatically handled by CMake in cmLocalGenerator::GetIncludeFlags() + # by additionally passing the 'QtFoo.framework/..' dir with an -iframework argument. + list(APPEND ${public_headers_list} "$") endif() list(APPEND ${public_headers_list} ${arg_PUBLIC_INCLUDE_DIRECTORIES}) -- cgit v1.2.3