diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 63b97f3787..b75a574c76 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1340,12 +1340,25 @@ bool cmQtAutoGenInitializer::InitAutogenTarget() } if (this->Uic.Enabled) { - // Make all ui_*.h files byproducts of the ${target}_autogen/timestamp - // custom command if the generation of depfile is enabled. - auto& byProducts = useDepfile ? timestampByproducts : autogenByproducts; - for (auto const& file : this->Uic.UiHeaders) { - this->AddGeneratedSource(file.first, this->Uic); - byProducts.push_back(file.second); + auto const useAdvancedUicGraph = [this]() -> bool { + if (this->MultiConfig && this->GlobalGen->IsNinja()) { + return this->UseBetterGraph; + } + return true; + }(); + if (useAdvancedUicGraph) { + // Make all ui_*.h files byproducts of the ${target}_autogen/timestamp + // custom command if the generation of depfile is enabled. + auto& byProducts = useDepfile ? timestampByproducts : autogenByproducts; + for (auto const& file : this->Uic.UiHeaders) { + this->AddGeneratedSource(file.first, this->Uic); + byProducts.push_back(file.second); + } + } else { + for (auto const& file : this->Uic.UiHeaders) { + this->AddGeneratedSource(file.first, this->Uic); + autogenByproducts.push_back(file.second); + } } } diff --git a/Tests/RunCMake/Autogen_6/RunCMakeTest.cmake b/Tests/RunCMake/Autogen_6/RunCMakeTest.cmake index b629a5cfea..66514f961e 100644 --- a/Tests/RunCMake/Autogen_6/RunCMakeTest.cmake +++ b/Tests/RunCMake/Autogen_6/RunCMakeTest.cmake @@ -6,6 +6,7 @@ if (DEFINED with_qt_version) -Dwith_qt_version=${with_qt_version} "-DQt${with_qt_version}_DIR:PATH=${Qt${with_qt_version}_DIR}" "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}" + "-DCMAKE_AUTOGEN_BETTER_GRAPH_MULTI_CONFIG=ON" ) if (QtCore_VERSION VERSION_GREATER_EQUAL 5.15.0) macro(set_test_variables_for_unwanted_builds)