summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-09-25 19:48:30 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-09-26 11:25:20 +0200
commit151323b94b20fe2be520e552e995d5e476a788f4 (patch)
tree406eb8fc3ceb8c7053c2aa022fb88892386fd683
parent19d2e61f87f822f1da2bad7108222b075c1816a2 (diff)
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 <QtNetworkAuth/QOAuth2AuthorizationCodeFlow> 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 <qt_ci_bot@qt-project.org> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
-rw-r--r--cmake/QtModuleHelpers.cmake8
1 files changed, 8 insertions, 0 deletions
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} "$<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}/${module}>")
+
+ # 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} "$<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}>")
endif()
list(APPEND ${public_headers_list} ${arg_PUBLIC_INCLUDE_DIRECTORIES})