From e1c1558218168529ea3fd1ab2e8b775c152ef7ee Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 29 Apr 2021 16:55:16 +0200 Subject: [PATCH] CMake: Fix reconfiguration when using a static top-level build ... and configuring another repo using qt-configure-module. It's possible to configure a top-level Qt with a subset of repos and then afterwards configure additional repos with qt-configure-module. We didn't define QT_REPO_DEPENDENCIES in that case, which caused all plugin config files to be loaded on reconfiguration, thus causing duplicate target errors. Move the QT_SUPERBUILD check to be done every time in QtBuildInternals.cmake rather than when configuring qtbase/qt5. Amends 98e8180e56322ce065e39cc1ef1d65b54caa8c25 Pick-to: 6.1 Fixes: QTBUG-86670 Fixes: QTBUG-91887 Fixes: QTBUG-92578 Change-Id: I975835ffa02f702799a3c9f68a5e059d2763a951 Reviewed-by: Joerg Bornemann --- cmake/QtPostProcessHelpers.cmake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmake/QtPostProcessHelpers.cmake b/cmake/QtPostProcessHelpers.cmake index 0193452ae01..6e09fcdf94c 100644 --- a/cmake/QtPostProcessHelpers.cmake +++ b/cmake/QtPostProcessHelpers.cmake @@ -624,10 +624,14 @@ endif() string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS "${install_prefix_content}") - if(NOT QT_SUPERBUILD AND NOT BUILD_SHARED_LIBS) + if(NOT BUILD_SHARED_LIBS) + # The top-level check needs to happen inside QtBuildInternals, because it's possible + # to configure a top-level build with a few repos and then configure another repo + # using qt-configure-module in a separate build dir, where QT_SUPERBUILD will not + # be set anymore. string(APPEND QT_EXTRA_BUILD_INTERNALS_VARS " -if(DEFINED QT_REPO_MODULE_VERSION AND NOT DEFINED QT_REPO_DEPENDENCIES) +if(DEFINED QT_REPO_MODULE_VERSION AND NOT DEFINED QT_REPO_DEPENDENCIES AND NOT QT_SUPERBUILD) qt_internal_read_repo_dependencies(QT_REPO_DEPENDENCIES \"$\{PROJECT_SOURCE_DIR}\") endif() ")