Fix build with CMake 3.16

Do not read the target property LINK_LIBRARIES from interface libraries
as this leads to errors with CMake 3.16.

This amends commit 326b91ea78.

Pick-to: 6.2
Change-Id: I44251c7633d5ecd977cd05746ac311dd1285d1e3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2021-10-12 10:55:56 +02:00
parent d24651d548
commit 0098e0ca86

View File

@ -99,10 +99,15 @@ endfunction()
function(qt_get_direct_module_dependencies target out_var)
cmake_parse_arguments(arg "PRIVATE" "" "" ${ARGN})
set(dependencies "")
get_target_property(target_type ${target} TYPE)
if(arg_PRIVATE)
get_target_property(libs ${target} LINK_LIBRARIES)
if(target_type STREQUAL "INTERFACE_LIBRARY")
set(libs)
else()
get_target_property(libs ${target} LINK_LIBRARIES)
list(REMOVE_DUPLICATES libs)
endif()
get_target_property(public_libs ${target} INTERFACE_LINK_LIBRARIES)
list(REMOVE_DUPLICATES libs)
list(REMOVE_DUPLICATES public_libs)
# Remove all Qt::Foo and Qt6::Foo from libs that also appear in public_libs.
@ -124,7 +129,6 @@ function(qt_get_direct_module_dependencies target out_var)
if(NOT libs)
set(libs "")
endif()
get_target_property(target_type ${target} TYPE)
while(libs)
list(POP_FRONT libs lib)
string(GENEX_STRIP "${lib}" lib)