Create module tools packages (config files) automatically

Previously you had to make sure to use DISABLE_TOOLS_EXPORT
in an add_qt_module call if the tools are built after the module,
as well as to manually call qt_export_tools after all associated
tools are built.

This was needlessly complex, especially for people that are porting
a repo with tools for the first time.

The tools package creation is now automatically done at QtPostProcess
step, so there is no need to use either DISABLE_TOOLS_EXPORT or
qt_export_tools() manually.

DISABLE_TOOLS_EXPORT is now a no-op, and will be removed once all repos
are updated not to use it.

Change-Id: I965b0d3a8a0cb908afae87b047083ed7bea9f02f
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2019-09-21 21:22:09 +02:00
parent 1144c08be8
commit fbddf745e9
4 changed files with 9 additions and 10 deletions

View File

@ -58,9 +58,6 @@ if (QT_WILL_BUILD_TOOLS)
add_subdirectory(qmake)
endif()
# Need to build qmake and other Core tools before exporting them.
qt_export_tools(Core)
# As long as we use the mkspecs (for qplatformdefs.h), we need to always
# install it, especially when cross-compiling.
set(mkspecs_install_dir "${INSTALL_DATADIR}")

View File

@ -1589,16 +1589,11 @@ set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
if(NOT ${arg_NO_PRIVATE_MODULE})
target_include_directories("${target_private}" INTERFACE ${interface_includes})
endif()
if(NOT ${arg_DISABLE_TOOLS_EXPORT})
qt_export_tools(${target})
endif()
endfunction()
function(qt_export_tools module_name)
# If no tools were defined belonging to this module, don't create a config and targets file.
# Guards against the case when doing a cross-build and the function is called manually and not
# by add_qt_module.
# Guards against the case when doing a cross-build.
if(NOT "${module_name}" IN_LIST QT_KNOWN_MODULES_WITH_TOOLS OR CMAKE_CROSSCOMPILING)
return()

View File

@ -332,6 +332,14 @@ function(qt_modules_process_android_dependencies)
endforeach()
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}")
endforeach()
endfunction()
qt_create_tools_config_files()
qt_internal_create_depends_files()
qt_generate_build_internals_extra_cmake_code()
qt_internal_create_plugins_files()

View File

@ -253,7 +253,6 @@ add_qt_module(Core
WrapDoubleConversion::WrapDoubleConversion # special case
PUBLIC_LIBRARIES # special case:
Qt::Platform # special case:
DISABLE_TOOLS_EXPORT # special case:
# special case begin
# Generated in QtBaseGlobalTargets
EXTRA_CMAKE_FILES ${QT_CORE_RESOURCE_GENERATED_FILE_PATH}