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 <alexandru.croitor@qt.io>
This commit is contained in:
Simon Hausmann 2019-06-25 14:44:29 +02:00
parent e25f9e2008
commit 6290efc4eb
3 changed files with 13 additions and 11 deletions

View File

@ -2174,9 +2174,9 @@ macro(qt_find_package)
endif() endif()
if(arg_COMPONENTS) if(arg_COMPONENTS)
set_target_properties(${qt_find_package_target_name} string(REPLACE ";" " " components_as_string "${arg_COMPONENTS}")
PROPERTIES set_property(TARGET ${qt_find_package_target_name}
INTERFACE_QT_PACKAGE_COMPONENTS ${arg_COMPONENTS}) PROPERTY INTERFACE_QT_PACKAGE_COMPONENTS ${components_as_string})
endif() endif()
get_property(is_global TARGET ${qt_find_package_target_name} PROPERTY get_property(is_global TARGET ${qt_find_package_target_name} PROPERTY

View File

@ -18,10 +18,11 @@ foreach(_target_dep ${_third_party_deps})
endif() endif()
if(components) if(components)
list(APPEND find_package_args "COMPONENTS" ${components}) string(REPLACE " " ";" components "${components}")
endif() find_dependency(${find_package_args} COMPONENTS ${components})
else()
find_dependency(${find_package_args}) find_dependency(${find_package_args})
endif()
if (NOT ${pkg}_FOUND) if (NOT ${pkg}_FOUND)
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE) set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)

View File

@ -17,13 +17,14 @@ foreach(_target_dep ${_third_party_deps})
list(APPEND find_package_args "${version}") list(APPEND find_package_args "${version}")
endif() endif()
if(components)
list(APPEND find_package_args "COMPONENTS" ${components})
endif()
if (NOT ${pkg}_FOUND) if (NOT ${pkg}_FOUND)
if(components)
string(REPLACE " " ";" components "${components}")
find_dependency(${find_package_args} COMPONENTS ${components})
else()
find_dependency(${find_package_args}) find_dependency(${find_package_args})
endif() endif()
endif()
if (NOT ${pkg}_FOUND) if (NOT ${pkg}_FOUND)
set(@target@_FOUND FALSE) set(@target@_FOUND FALSE)