CMake: Fix generation of target deployment information

The _qt_internal_write_target_deploy_info function doesn't clear its
result variable, which is why we had left-over elements in the targets
variable. Some of these left-overs have a target type that's not
compatible with TARGET_RUNTIME_DLLS, leading to the CMake error:

    Objects of target "lib1" referenced but is not one of the allowed
    target types (EXECUTABLE, SHARED, MODULE).".

Fix this by clearing the targets variable initially.

Fixes: QTBUG-119792
Change-Id: I921aa2f0af72638ed0ed7434450a43c66c1fc9f1
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
bb10
Joerg Bornemann 2023-12-07 13:49:15 +01:00
parent 2e154ac020
commit c29029c4cd
1 changed files with 1 additions and 0 deletions

View File

@ -2932,6 +2932,7 @@ endfunction()
# Write deployment information for the targets of the project.
function(_qt_internal_write_target_deploy_info out_file)
set(targets "")
_qt_internal_collect_buildsystem_targets(targets
"${CMAKE_SOURCE_DIR}" INCLUDE EXECUTABLE SHARED_LIBRARY MODULE_LIBRARY)
set(content "")