summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-08-05 14:56:51 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-08-06 19:19:46 +0200
commitd50a7d635ca20fa76d289bb2b043bc0177505703 (patch)
treebc4ffbee377e4154ebec39fbd4eb0449421d7954
parent9a900dfb0794a24b9930fe75c7f0e8f208ca6be9 (diff)
CMake: Fix prl files of static Qt builds
Static Qt plugins should not be included in the list of libraries of a prl file. They end up being there due to our circular dependency trick where the plugins depend on the module they belong to. This in turn causes the giant static plugin generator expressions to be processed in qt_collect_libs(), and the generated prl file ends up having target names like Qt6::QJpegPlugin which are obviously not linker flags. To eliminate the static plugins from prl files, add an additional dummy boolean generator expression '$<BOOL:QT_IS_PLUGIN_GENEX>' that always evaluates to true. We can string match on this expression in qt_collect_libs, and thus remove the whole static plugin genex entry. This should fix linking of apps with qmake that use a CMake-built static Qt. Task-number: QTBUG-85865 Task-number: QTBUG-85240 Task-number: QTBUG-85801 Change-Id: I949dc5edb10d94c4ab84ed430af7c164d8efaaa6 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
-rw-r--r--cmake/QtBuild.cmake6
-rw-r--r--cmake/QtPlugins.cmake.in4
2 files changed, 10 insertions, 0 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index cac9e22c73..982ac52c5a 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -3247,6 +3247,12 @@ function(qt_internal_walk_libs target out_var dict_name operation)
lib "${lib}")
endwhile()
+ # Skip static plugins.
+ set(_is_plugin_marker_genex "\\$<BOOL:QT_IS_PLUGIN_GENEX>")
+ if(lib MATCHES "${_is_plugin_marker_genex}")
+ continue()
+ endif()
+
if(lib MATCHES "^\\$<TARGET_OBJECTS:")
# Skip object files.
continue()
diff --git a/cmake/QtPlugins.cmake.in b/cmake/QtPlugins.cmake.in
index 91884302c6..d6d5c829b2 100644
--- a/cmake/QtPlugins.cmake.in
+++ b/cmake/QtPlugins.cmake.in
@@ -19,6 +19,9 @@ 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>>")
+ # Plugin genex marker for prl processing.
+ set(_is_plugin_marker_genex "$<BOOL:QT_IS_PLUGIN_GENEX>")
+
# 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
@@ -94,6 +97,7 @@ if(NOT @BUILD_SHARED_LIBS@)
# Complete condition that defines whether a static plugin is linked
string(CONCAT _plugin_condition
"$<BOOL:$<AND:"
+ "${_is_plugin_marker_genex},"
"${_build_allow_plugin_link_rules_genex},"
"$<OR:"
"${_plugin_is_whitelisted},"