From 9c1b7802d7f118b55ccc04dab74e1ee19e6d429f Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 5 Sep 2019 17:16:31 +0200 Subject: [PATCH] Avoid unnecessary find_package calls when using Qt with shared builds Don't create the plugin config files when doing shared builds, otherwise for example Qt6GuiPlugins.cmake will try to include the xcb plugin cmake config, which in turn will perform a full-fledged find_package series to locate xcb. When an application just uses find_package(Qt6Gui), then that is not needed. Change-Id: I1890aaa5be8e214151c65fa981f547a73c0ca7fc Reviewed-by: Alexandru Croitor Reviewed-by: Qt CMake Build Bot --- cmake/QtPostProcess.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/QtPostProcess.cmake b/cmake/QtPostProcess.cmake index 8a09efe35a1..880e73e869e 100644 --- a/cmake/QtPostProcess.cmake +++ b/cmake/QtPostProcess.cmake @@ -267,6 +267,11 @@ endfunction() # This function creates the QtPlugins.cmake used to list all # the plug-in target files. function(qt_internal_create_plugins_files) + # The plugins cmake configuration is only needed for static builds. Dynamic builds don't need + # the application to link against plugins at build time. + if(NOT QT_BUILD_SHARED_LIBS) + return() + endif() qt_internal_get_qt_repo_known_modules(repo_known_modules) message("Generating Plugins files for ${repo_known_modules}...")