From a3f1b8e4d9e24cca4ed2eca2da19b69ff42bbbbc Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 24 Oct 2023 17:48:55 +0200 Subject: [PATCH] Do not collect the Private module dependencies values in public variables Qt ModuleConfig.cmake files set variables like _INCLUDE_DIRS, _DEFINITIONS, etc., which can be used by user projects to acquire the module related information. These variables also accumulate information from Qt Module dependencies. Since we do not separate the Private and regular modules in dependency list, the resulting variables contain values from both. This change puts the information from Private dependencies to the variables of Private module. The exception is PRIVATE_INCLUDE_DIRS which will contain include directories from Private dependencies for non-Private module too. Fixes: QTBUG-118462 Change-Id: I51e6d63651ed1913005064c90f77eba219cf60ea Reviewed-by: Joerg Bornemann --- cmake/QtModuleConfig.cmake.in | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/cmake/QtModuleConfig.cmake.in b/cmake/QtModuleConfig.cmake.in index cdb79f4bbb..a8efc6858d 100644 --- a/cmake/QtModuleConfig.cmake.in +++ b/cmake/QtModuleConfig.cmake.in @@ -74,15 +74,25 @@ if (NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target@_FOUND) ${_@QT_CMAKE_EXPORT_NAMESPACE@@target@_OWN_PRIVATE_INCLUDE_DIRS}) foreach(_module_dep ${_@QT_CMAKE_EXPORT_NAMESPACE@@target@_MODULE_DEPENDENCIES}) - list(APPEND @QT_CMAKE_EXPORT_NAMESPACE@@target@_INCLUDE_DIRS + if(_module_dep MATCHES ".+Private$") + set(_private_suffix "Private") + else() + set(_private_suffix "") + endif() + list(APPEND @QT_CMAKE_EXPORT_NAMESPACE@@target@${_private_suffix}_INCLUDE_DIRS ${@QT_CMAKE_EXPORT_NAMESPACE@${_module_dep}_INCLUDE_DIRS}) - list(APPEND @QT_CMAKE_EXPORT_NAMESPACE@@target@_PRIVATE_INCLUDE_DIRS + list(APPEND @QT_CMAKE_EXPORT_NAMESPACE@@target@${_private_suffix}_PRIVATE_INCLUDE_DIRS ${@QT_CMAKE_EXPORT_NAMESPACE@${_module_dep}_PRIVATE_INCLUDE_DIRS}) - list(APPEND @QT_CMAKE_EXPORT_NAMESPACE@@target@_DEFINITIONS + if(_private_suffix) + list(APPEND @QT_CMAKE_EXPORT_NAMESPACE@@target@_PRIVATE_INCLUDE_DIRS + ${@QT_CMAKE_EXPORT_NAMESPACE@${_module_dep}_PRIVATE_INCLUDE_DIRS}) + endif() + list(APPEND @QT_CMAKE_EXPORT_NAMESPACE@@target@${_private_suffix}_DEFINITIONS ${@QT_CMAKE_EXPORT_NAMESPACE@${_module_dep}_DEFINITIONS}) - list(APPEND @QT_CMAKE_EXPORT_NAMESPACE@@target@_COMPILE_DEFINITIONS + list(APPEND @QT_CMAKE_EXPORT_NAMESPACE@@target@${_private_suffix}_COMPILE_DEFINITIONS ${@QT_CMAKE_EXPORT_NAMESPACE@${_module_dep}_COMPILE_DEFINITIONS}) endforeach() + unset(_private_suffix) list(REMOVE_DUPLICATES @QT_CMAKE_EXPORT_NAMESPACE@@target@_INCLUDE_DIRS) list(REMOVE_DUPLICATES @QT_CMAKE_EXPORT_NAMESPACE@@target@_PRIVATE_INCLUDE_DIRS)