summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@qt.io>2021-02-15 12:18:28 +1100
committerCraig Scott <craig.scott@qt.io>2021-02-24 10:38:15 +1100
commitbe7e20213cc34d6ab23d3db938c6b9317034c9d7 (patch)
tree6015d068c440e567c0c7f06fdfcd489a7db3729e /cmake
parent279ebfd487a8e43a65f50f273c6b6ee8cdbec0a4 (diff)
Avoid cyclic dependency between plugin and module *Config.cmake files
In static per-repo builds, we have a mix of targets provided by packages and targets provided by the main build. For the builds that create the packages, we must avoid adding a dependency for the main module library target on its associated plugin targets or else the package config files end up with a cyclic dependency that cannot be resolved when something tries to consume them. This only happens for static builds because we have been attaching a linking relationship to the main module library that isn't really a true dependency, we attached it only for convenience of things linking to that module library. To preserve that convenience linking without breaking the config packages, we use the QT_NO_CREATE_TARGETS condition to prevent CMake seeing that relationship when generating the *Config.cmake files. Creating these relationships will be delayed until the plugin's *Config.cmake file is loaded, at which point it will add itself to the main module library's imported target INTERFACE (this was already done before, we just now rely solely on that). Task-number: QTBUG-90819 Pick-to: 6.1 Change-Id: Id725742182bcda64841be84fe1650bafb9151bb1 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtPlugins.cmake.in2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmake/QtPlugins.cmake.in b/cmake/QtPlugins.cmake.in
index 8e54eea843..6df9541e18 100644
--- a/cmake/QtPlugins.cmake.in
+++ b/cmake/QtPlugins.cmake.in
@@ -156,6 +156,6 @@ function(__qt_internal_add_static_plugins_once)
set_target_properties(${_module_target} PROPERTIES __qt_internal_plugins_added TRUE)
endfunction()
-if(NOT @BUILD_SHARED_LIBS@)
+if(NOT @BUILD_SHARED_LIBS@ AND NOT QT_NO_CREATE_TARGETS)
__qt_internal_add_static_plugins_once()
endif()