From 6290efc4ebbdf547e16f5728b8393d1e75a4ed89 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 25 Jun 2019 14:44:29 +0200 Subject: [PATCH] Fix building against an installed static Qt For ICU we have multiple components, and ICU becomes a public dependency to QtCore. When storing the INTERFACE_QT_PACKAGE_COMPONENTS property, make sure to store the entire list of components, not just the first component -- by turning the semi-colon separated list into a space separated list. When processing the components at find_dependency time, we need to reverse that and pass COMPONENTS directly to ensure a correct parameter expansion. Change-Id: I24a0708520e7d5fba039395a151034aee4d4c0e2 Reviewed-by: Alexandru Croitor --- cmake/QtBuild.cmake | 6 +++--- cmake/QtModuleDependencies.cmake.in | 7 ++++--- cmake/QtPluginDependencies.cmake.in | 11 ++++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index 2eb20660c21..62117ce3c31 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -2174,9 +2174,9 @@ macro(qt_find_package) endif() if(arg_COMPONENTS) - set_target_properties(${qt_find_package_target_name} - PROPERTIES - INTERFACE_QT_PACKAGE_COMPONENTS ${arg_COMPONENTS}) + string(REPLACE ";" " " components_as_string "${arg_COMPONENTS}") + set_property(TARGET ${qt_find_package_target_name} + PROPERTY INTERFACE_QT_PACKAGE_COMPONENTS ${components_as_string}) endif() get_property(is_global TARGET ${qt_find_package_target_name} PROPERTY diff --git a/cmake/QtModuleDependencies.cmake.in b/cmake/QtModuleDependencies.cmake.in index b4f27ba85c7..81d6431c672 100644 --- a/cmake/QtModuleDependencies.cmake.in +++ b/cmake/QtModuleDependencies.cmake.in @@ -18,11 +18,12 @@ foreach(_target_dep ${_third_party_deps}) endif() if(components) - list(APPEND find_package_args "COMPONENTS" ${components}) + string(REPLACE " " ";" components "${components}") + find_dependency(${find_package_args} COMPONENTS ${components}) + else() + find_dependency(${find_package_args}) endif() - find_dependency(${find_package_args}) - if (NOT ${pkg}_FOUND) set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE) return() diff --git a/cmake/QtPluginDependencies.cmake.in b/cmake/QtPluginDependencies.cmake.in index b456db58c12..6ca392ec647 100644 --- a/cmake/QtPluginDependencies.cmake.in +++ b/cmake/QtPluginDependencies.cmake.in @@ -17,12 +17,13 @@ foreach(_target_dep ${_third_party_deps}) list(APPEND find_package_args "${version}") endif() - if(components) - list(APPEND find_package_args "COMPONENTS" ${components}) - endif() - if (NOT ${pkg}_FOUND) - find_dependency(${find_package_args}) + if(components) + string(REPLACE " " ";" components "${components}") + find_dependency(${find_package_args} COMPONENTS ${components}) + else() + find_dependency(${find_package_args}) + endif() endif() if (NOT ${pkg}_FOUND)