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>
This commit is contained in:
parent
9a900dfb07
commit
d50a7d635c
@ -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()
|
||||
|
@ -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},"
|
||||
|
Loading…
Reference in New Issue
Block a user