From 0098e0ca86b69cfbd89528977dadb2ac3e616eed Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Tue, 12 Oct 2021 10:55:56 +0200 Subject: [PATCH] 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 326b91ea788b013512ae911c51cc19497d88916d. Pick-to: 6.2 Change-Id: I44251c7633d5ecd977cd05746ac311dd1285d1e3 Reviewed-by: Alexandru Croitor --- cmake/QtPriHelpers.cmake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmake/QtPriHelpers.cmake b/cmake/QtPriHelpers.cmake index 3076a314c9..85767fadbe 100644 --- a/cmake/QtPriHelpers.cmake +++ b/cmake/QtPriHelpers.cmake @@ -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)