diff options
| author | Alexandru Croitor <[email protected]> | 2025-11-17 19:07:03 +0100 |
|---|---|---|
| committer | Alexandru Croitor <[email protected]> | 2025-11-27 15:22:48 +0100 |
| commit | 7e36a23467e3572a282a76cb1e2319f53499fed9 (patch) | |
| tree | 2ddd8a0c887367a8b9998fe46df54ea28a422702 /cmake/QtPostProcessHelpers.cmake | |
| parent | b0f25bc6a7c40b36b6cab4f53d2ef44f1b6d4632 (diff) | |
CMake: Allow creating a standalone Tools package without a module
Add a new qt_internal_add_tools_package function to allow creating a
standalone Tools cmake package.
It can be useful for a repo which might build e.g. an arch-independent
java tool exposed by an IMPORTED executable, but has no associated
C++ Qt module.
Also add a
qt_internal_record_tools_package_extra_third_party_dependency function
to allow looking up additional third party cmake packages when finding
the tool package.
Change-Id: I46f5fb9f7a361ecf4018f0fc1ed0a1f8ecf12df3
Reviewed-by: Joerg Bornemann <[email protected]>
Diffstat (limited to 'cmake/QtPostProcessHelpers.cmake')
| -rw-r--r-- | cmake/QtPostProcessHelpers.cmake | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/cmake/QtPostProcessHelpers.cmake b/cmake/QtPostProcessHelpers.cmake index b8e46085a98..f0ac617bff9 100644 --- a/cmake/QtPostProcessHelpers.cmake +++ b/cmake/QtPostProcessHelpers.cmake @@ -801,8 +801,15 @@ endfunction() function(qt_create_tools_config_files) # Create packages like Qt6CoreTools/Qt6CoreToolsConfig.cmake. foreach(module_name ${QT_KNOWN_MODULES_WITH_TOOLS}) - qt_export_tools("${module_name}") + qt_export_tools(MODULE_NAME "${module_name}") endforeach() + + get_cmake_property(standalone_packages _qt_standalone_tool_packages) + if(standalone_packages) + foreach(package_name IN LISTS standalone_packages) + qt_export_tools(PACKAGE_BASE_NAME "${package_name}") + endforeach() + endif() endfunction() function(qt_internal_create_config_file_for_standalone_tests) @@ -835,9 +842,11 @@ function(qt_internal_create_config_file_for_standalone_tests) endif() endforeach() - # Skip generating and installing file if no modules were built. This make sure not to install - # anything when build qtx11extras on macOS for example. - if(NOT modules) + get_cmake_property(tool_package_base_names _qt_standalone_tool_packages) + + # Skip generating and installing file if no modules or tools were built. This makes sure not + # to install anything when building qtx11extras on macOS for example. + if(NOT modules AND NOT tool_package_base_names) return() endif() @@ -846,7 +855,22 @@ function(qt_internal_create_config_file_for_standalone_tests) qt_internal_get_standalone_parts_config_file_name(tests_config_file_name) # Substitution variables. - list(JOIN modules "\n " QT_MODULE_PACKAGES) + if(modules) + list(JOIN modules "\n " module_string) + set(QT_MODULE_PACKAGES " QT_MODULE_PACKAGES + ${module_string}") + endif() + + if(tool_package_base_names) + # We only have the base package names, so we need to append Tools to each of the package + # names + set(tool_packages "${tool_package_base_names}") + list(TRANSFORM tool_packages APPEND Tools) + + list(JOIN tool_packages "\n " tool_packages_string) + set(QT_TOOL_PACKAGES " QT_TOOL_PACKAGES + ${tool_packages_string}") + endif() configure_file( "${QT_CMAKE_DIR}/QtStandaloneTestsConfig.cmake.in" |
