pro2cmake: Write only one find_package call for Qt packages
Task-number: QTBUG-96799 Change-Id: I1eb8ac05f360b74e5ae1217b5535a33227b5084b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
f5a8d70dee
commit
1c2f6d2ace
@ -786,6 +786,7 @@ def generate_find_package_info(
|
|||||||
indent: int = 0,
|
indent: int = 0,
|
||||||
emit_if: str = "",
|
emit_if: str = "",
|
||||||
use_system_package_name: bool = False,
|
use_system_package_name: bool = False,
|
||||||
|
remove_REQUIRED_from_extra: bool = True,
|
||||||
module: str = "",
|
module: str = "",
|
||||||
) -> str:
|
) -> str:
|
||||||
isRequired = False
|
isRequired = False
|
||||||
@ -797,7 +798,8 @@ def generate_find_package_info(
|
|||||||
|
|
||||||
if "REQUIRED" in extra and use_qt_find_package:
|
if "REQUIRED" in extra and use_qt_find_package:
|
||||||
isRequired = True
|
isRequired = True
|
||||||
extra.remove("REQUIRED")
|
if remove_REQUIRED_from_extra:
|
||||||
|
extra.remove("REQUIRED")
|
||||||
|
|
||||||
cmake_target_name = lib.targetName
|
cmake_target_name = lib.targetName
|
||||||
assert cmake_target_name
|
assert cmake_target_name
|
||||||
|
@ -3741,9 +3741,25 @@ def write_find_package_section(
|
|||||||
if info and info not in packages:
|
if info and info not in packages:
|
||||||
packages.append(info)
|
packages.append(info)
|
||||||
|
|
||||||
# ind = spaces(indent)
|
qt_components: List[str] = []
|
||||||
|
for p in filter(LibraryMapping.is_qt, packages):
|
||||||
|
if p.components is not None:
|
||||||
|
qt_components += p.components
|
||||||
|
if qt_components:
|
||||||
|
qt_components = sorted(qt_components)
|
||||||
|
qt_package = LibraryMapping(
|
||||||
|
"unknown", "Qt6", "unknown", extra=["REQUIRED"], components=qt_components
|
||||||
|
)
|
||||||
|
cm_fh.write(
|
||||||
|
generate_find_package_info(
|
||||||
|
qt_package,
|
||||||
|
use_qt_find_package=False,
|
||||||
|
remove_REQUIRED_from_extra=False,
|
||||||
|
indent=indent,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
for p in packages:
|
for p in itertools.filterfalse(LibraryMapping.is_qt, packages):
|
||||||
cm_fh.write(generate_find_package_info(p, use_qt_find_package=False, indent=indent))
|
cm_fh.write(generate_find_package_info(p, use_qt_find_package=False, indent=indent))
|
||||||
|
|
||||||
if packages:
|
if packages:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user