CMake: Generate less pri files and mark header modules as no_link

Plugins will no longer get .pri files generated in non-static builds.

Header modules are now marked in the .pri files as CONFIG += no_link.

Fixes: QTBUG-88221
Change-Id: I06e31fa970ad021261c43ca3acd88055cc4c9555
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 98e6234bd4a910ab1b3873bafc9da33aab499e2e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Cristian Adam 2020-11-19 15:35:28 +01:00 committed by Qt Cherry-pick Bot
parent ab3f3d5c4d
commit 0bc41f5601
2 changed files with 9 additions and 5 deletions

View File

@ -218,7 +218,9 @@ function(qt_internal_add_plugin target)
endforeach()
qt_register_target_dependencies("${target}" "${arg_PUBLIC_LIBRARIES}" "${qt_libs_private}")
qt_generate_plugin_pri_file("${target}" pri_file)
if (NOT BUILD_SHARED_LIBS)
qt_generate_plugin_pri_file("${target}" pri_file)
endif()
if (NOT arg_SKIP_INSTALL)
# Handle creation of cmake files for consumers of find_package().
@ -256,10 +258,9 @@ function(qt_internal_add_plugin target)
DESTINATION "${config_install_dir}"
COMPONENT Devel
)
qt_install(FILES
"${pri_file}"
DESTINATION "${INSTALL_MKSPECSDIR}/modules"
)
if(pri_file)
qt_install(FILES "${pri_file}" DESTINATION "${INSTALL_MKSPECSDIR}/modules")
endif()
# Make the export name of plugins be consistent with modules, so that
# qt_add_resource adds its additional targets to the same export set in a static Qt build.

View File

@ -186,6 +186,9 @@ function(qt_generate_module_pri_file target)
get_target_property(config_module_name ${target} _qt_config_module_name)
get_target_property(qmake_module_config ${target} ${property_prefix}QT_QMAKE_MODULE_CONFIG)
if (arg_HEADER_MODULE)
list(APPEND qmake_module_config "no_link")
endif()
if(qmake_module_config)
string(REPLACE ";" " " module_build_config "${qmake_module_config}")
set(module_build_config "\nQT.${config_module_name}.CONFIG = ${module_build_config}")