diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-04-28 15:25:18 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-05-11 18:57:17 +0200 |
commit | b104bedea171825db06cc257179bb3e05915a159 (patch) | |
tree | 55e601dcef355da3cc1cb1247d6b7bea7dea2cd7 /cmake/QtBaseGlobalTargets.cmake | |
parent | 867c0b8d8a53974074b1fff5b132f3ae9f150066 (diff) |
CMake: Refactor handling of static plugins
Extract common static plugin handling functionality into a separate
QtPublicPluginHelpers.cmake file which is loaded by the Qt6 package.
Split the code into smaller functions that will be re-used by each
templated QtPlugins.cmake.in file, rather than copy pasting the same
code into each QtFooPlugins.cmake file.
As a drive-by, handle QtFeatures.cmake and QtFeaturesCommon.cmake
as public helper files just like QtPublicPluginHelpers.cmake.
This makes it clearer that the functions are available outside
the internal Qt build and also provides a way for not dumping new
helper functions into Qt6CoreMacros.cmake.
Task-number: QTBUG-92933
Change-Id: Id816ef009b4fac1cd317d3ef23f21b3530028067
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'cmake/QtBaseGlobalTargets.cmake')
-rw-r--r-- | cmake/QtBaseGlobalTargets.cmake | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake index a1f81ecb90..0f5d68cd0c 100644 --- a/cmake/QtBaseGlobalTargets.cmake +++ b/cmake/QtBaseGlobalTargets.cmake @@ -159,7 +159,9 @@ qt_internal_export_modern_cmake_config_targets_file(TARGETS ${__export_targets} CONFIG_INSTALL_DIR ${__GlobalConfig_install_dir}) -## Install some QtBase specific CMake files: +# Install internal CMake files. +# The functions defined inside can not be used in public projects. +# They can only be used while building Qt itself. qt_copy_or_install(FILES cmake/ModuleDescription.json.in cmake/Qt3rdPartyLibraryConfig.cmake.in @@ -179,8 +181,6 @@ qt_copy_or_install(FILES cmake/QtDbusHelpers.cmake cmake/QtDocsHelpers.cmake cmake/QtExecutableHelpers.cmake - cmake/QtFeature.cmake - cmake/QtFeatureCommon.cmake cmake/QtFileConfigure.txt.in cmake/QtFindPackageHelpers.cmake cmake/QtFindWrapConfigExtra.cmake.in @@ -237,7 +237,25 @@ qt_copy_or_install(FILES DESTINATION "${__GlobalConfig_install_dir}" ) -file(COPY cmake/QtFeature.cmake DESTINATION "${__GlobalConfig_build_dir}") +# Install public CMake files. +# The functions defined inside can be used in both public projects and while building Qt. +# Usually we put such functions into Qt6CoreMacros.cmake, but that's getting bloated. +# These files will be included by Qt6Config.cmake. +set(__public_cmake_helpers + cmake/QtFeature.cmake + cmake/QtFeatureCommon.cmake + cmake/QtPublicPluginHelpers.cmake +) + +qt_copy_or_install(FILES ${__public_cmake_helpers} DESTINATION "${__GlobalConfig_install_dir}") + +# In prefix builds we also need to copy the files into the build config directory, so that the +# build-dir Qt6Config.cmake finds the files when building examples in-tree. +if(QT_WILL_INSTALL) + foreach(_public_cmake_helper ${__public_cmake_helpers}) + file(COPY "${_public_cmake_helper}" DESTINATION "${__GlobalConfig_build_dir}") + endforeach() +endif() # TODO: Check whether this is the right place to install these qt_copy_or_install(DIRECTORY cmake/3rdparty DESTINATION "${__GlobalConfig_install_dir}") |