summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-06-05 22:26:12 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-06-06 12:51:33 +0000
commite7d1ec61e39da682fb4942af9a9bf74a9dd5913c (patch)
tree57ff237c1cfe821f2ddc8b4e2fe4829d153077dc
parent053766d7968296b171aea1410a0e00184309185c (diff)
Collect more known modules when considering private libraries in
extend_target. In extend_target(Foo) we go over all the ModulePrivate dependencies to assign them to FooPrivate. To do that we use the QT_KNOWN_MODULES variable. The problem is that the variable gets reset when we build a new repository, so when we build qtdeclarative, QT_KNOWN_MODULES has no entries for Core, Gui, etc, but only Qml, Quick, etc. And yet QmlPrivate has to depend on CorePrivate. Change the module Config.cmake files to append their target name to a global variable called QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE. The global variable gets populated every time find_package(QtFoo) is called. Use the union of QT_KNOWN_MODULES and QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE when considering FooPrivate libraries. Change-Id: Ibd9449744478cea58eb5d9737cc8887b4df92420 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
-rw-r--r--cmake/QtBuild.cmake13
-rw-r--r--cmake/QtModuleConfig.cmake.in2
2 files changed, 13 insertions, 2 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index 166bb3b6c4..3ea85504c2 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -849,9 +849,18 @@ function(extend_target target)
_qt_target_deps "${target_deps}"
)
- # When a public module depends on private, also make its private depend on the other's private
+ # When computing the private library dependencies, we need to check not only the known
+ # modules added by this repo's qt_build_repo() (which are stored in QT_KNOWN_MODULES), but
+ # also all module dependencies that were found via find_package() (which are stored in
+ # QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE).
+ set(known_modules ${QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE} ${QT_KNOWN_MODULES})
+ list(REMOVE_DUPLICATES known_modules)
+
+ # When a public module depends on a private module (Gui on CorePrivate)
+ # make its private module depend on the other private module (GuiPrivate will depend on
+ # CorePrivate).
set(qt_libs_private "")
- foreach(it ${QT_KNOWN_MODULES})
+ foreach(it ${known_modules})
list(FIND arg_LIBRARIES "Qt::${it}Private" pos)
if(pos GREATER -1)
list(APPEND qt_libs_private "Qt::${it}Private")
diff --git a/cmake/QtModuleConfig.cmake.in b/cmake/QtModuleConfig.cmake.in
index fcf5ba4644..0522b7d1e2 100644
--- a/cmake/QtModuleConfig.cmake.in
+++ b/cmake/QtModuleConfig.cmake.in
@@ -31,3 +31,5 @@ set("@INSTALL_CMAKE_NAMESPACE@@target@_FOUND" TRUE)
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Plugins.cmake")
endif()
+
+list(APPEND QT_ALL_MODULES_FOUND_VIA_FIND_PACKAGE "@target@")