CMake: Record static libs and target type in for deployment

In <build-dir>/.qt/QtDeployTargets.cmake we recorded deployable targets
and their file path. We skipped static libraries, because we don't
consider these deployable.

However, we need information about static library targets too when
deploying QML plugins: we need to know that they are "built by us" in
order to properly skip them.

Now, we record STATIC_LIBRARY targets too and also record the type of
each target.

Task-number: QTBUG-124771
Change-Id: Ic1ef33a3295458c372c2bc9f24ecce43f17e7321
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 519a47e870dddc16879bad9a3f8398e0349fb76a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Joerg Bornemann 2024-05-03 17:17:33 +02:00 committed by Qt Cherry-pick Bot
parent a371f0fd8c
commit 94b2432f1b

View File

@ -3084,13 +3084,17 @@ endfunction()
# Write deployment information for the targets of the project.
function(_qt_internal_write_target_deploy_info out_file)
set(targets "")
set(dynamic_target_types EXECUTABLE SHARED_LIBRARY MODULE_LIBRARY)
_qt_internal_collect_buildsystem_targets(targets
"${CMAKE_SOURCE_DIR}" INCLUDE EXECUTABLE SHARED_LIBRARY MODULE_LIBRARY)
"${CMAKE_SOURCE_DIR}" INCLUDE ${dynamic_target_types} STATIC_LIBRARY)
set(content "")
foreach(target IN LISTS targets)
set(var_prefix "__QT_DEPLOY_TARGET_${target}")
string(APPEND content "set(${var_prefix}_FILE $<TARGET_FILE:${target}>)\n")
if(WIN32 AND CMAKE_VERSION GREATER_EQUAL "3.21")
get_target_property(target_type ${target} TYPE)
string(APPEND content "set(${var_prefix}_TYPE ${target_type})\n")
if(WIN32 AND CMAKE_VERSION GREATER_EQUAL "3.21"
AND target_type IN_LIST dynamic_target_types)
string(APPEND content
"set(${var_prefix}_RUNTIME_DLLS $<TARGET_RUNTIME_DLLS:${target}>)\n")
endif()