summaryrefslogtreecommitdiffstats
path: root/cmake/QtPlugins.cmake.in
diff options
context:
space:
mode:
authorJean-Michaƫl Celerier <jean-michael.celerier@kdab.com>2019-11-21 13:33:28 +0100
committerLeander Beernaert <leander.beernaert@qt.io>2020-01-08 10:42:21 +0000
commitea81b69cde70316b5b5b161d8fb9bf904b229523 (patch)
treee975067776a96a05c63e1a7c9d36c56a2ce93acc /cmake/QtPlugins.cmake.in
parenta182efb9c42630171879497efd05b5a5e644cf60 (diff)
Implement qtbase fixes for superbuilds
Change-Id: I0d3445cf0740e3925fa9342dac4d07892518afe5 Reviewed-by: Qt CMake Build Bot Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'cmake/QtPlugins.cmake.in')
-rw-r--r--cmake/QtPlugins.cmake.in31
1 files changed, 24 insertions, 7 deletions
diff --git a/cmake/QtPlugins.cmake.in b/cmake/QtPlugins.cmake.in
index fb87a54c0d..692b5b1836 100644
--- a/cmake/QtPlugins.cmake.in
+++ b/cmake/QtPlugins.cmake.in
@@ -1,3 +1,5 @@
+include_guard(DIRECTORY)
+
@QT_MODULE_PLUGIN_INCLUDES@
if(NOT @BUILD_SHARED_LIBS@)
@@ -17,6 +19,18 @@ if(NOT @BUILD_SHARED_LIBS@)
set(_manual_plugins_genex "$<GENEX_EVAL:$<TARGET_PROPERTY:QT_PLUGINS>>")
set(_no_plugins_genex "$<GENEX_EVAL:$<TARGET_PROPERTY:QT_NO_PLUGINS>>")
+ # In super builds the rules below pollute the dependency rule for the
+ # plugin target when it's being build, causing cyclic dependencies.
+ # to overcome this, we check if the current target where this rule evaluates
+ # has a QT_BUILD_PROJECT_NAME equal to the current PROJECT_NAME.
+ # If so we disable the injection of plugin link rules to avoid cyclic
+ # dependencies.
+ if (@QT_SUPERBUILD@)
+ set(_build_allow_plugin_link_rules_genex "$<NOT:$<STREQUAL:$<TARGET_PROPERTY:QT_BUILD_PROJECT_NAME>,@PROJECT_NAME@>>")
+ else()
+ set(_build_allow_plugin_link_rules_genex TRUE)
+ endif()
+
# The code in here uses the properties defined in qt_import_plugins (Qt6CoreMacros.cmake)
foreach(target @qt_plugins@)
set(_plugin_target "@INSTALL_CMAKE_NAMESPACE@::${target}")
@@ -64,13 +78,16 @@ if(NOT @BUILD_SHARED_LIBS@)
# Complete condition that defines whether a static plugin is linked
string(CONCAT _plugin_condition
- "$<BOOL:$<OR:"
- "${_plugin_is_whitelisted},"
- "${_plugin_is_in_type_whitelist},"
- "$<AND:"
- "${_default_plugins_are_enabled_wrapped},"
- "${_plugin_is_default},"
- "${_plugin_is_not_blacklisted}"
+ "$<BOOL:$<AND:"
+ "${_build_allow_plugin_link_rules_genex},"
+ "$<OR:"
+ "${_plugin_is_whitelisted},"
+ "${_plugin_is_in_type_whitelist},"
+ "$<AND:"
+ "${_default_plugins_are_enabled_wrapped},"
+ "${_plugin_is_default},"
+ "${_plugin_is_not_blacklisted}"
+ ">"
">"
">>"
)