CMake: Temporary workaround for static top-level Qt builds

Because find_package usually creates targets in a local scope,
qt_generate_prl_file fails to generate a .prl file that has
references to generator expressions like
"$<TARGET_FILE:Freetype::Freetype>" which references targets
that are not found in that specific scope (e.g Freetype target is
present in qtbase scope, but not qtsvg scope).

This happens in static top-level Qt builds, and thus fails the
configuration. While we try to figure out how to fix this adequatly,
don't generate .prl files in such a configuration.

Task-number: QTBUG-84874
Change-Id: I69cf0ad1419d21e3676e1374624601f00936c405
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
bb10
Alexandru Croitor 2020-06-10 13:04:13 +02:00
parent dc1dd51af3
commit dde11715d3
1 changed files with 7 additions and 1 deletions

View File

@ -2771,7 +2771,13 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
endfunction()
function(qt_finalize_module target)
qt_generate_prl_file(${target})
# Workaround to allow successful configuration of static top-level Qt builds.
# See QTBUG-84874.
if(QT_SUPERBUILD AND NOT BUILD_SHARED_LIBS)
# Do nothing.
else()
qt_generate_prl_file(${target})
endif()
qt_generate_module_pri_file("${target}" ${ARGN})
endfunction()