diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 37f4d69054..1fd406c50b 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -1613,13 +1613,17 @@ void cmQtAutoGenInitializer::AddCMakeProcessToCommandLines( std::string const& infoFile, std::string const& processName, cmCustomCommandLines& commandLines) { + std::vector autogenConfigs; + this->GlobalGen->GetQtAutoGenConfigs(autogenConfigs); if (this->CrossConfig && this->UseBetterGraph) { commandLines.push_back(cmMakeCommandLine( { cmSystemTools::GetCMakeCommand(), "-E", processName, infoFile, "$", "$>" })); } else if ((this->MultiConfig && this->GlobalGen->IsXcode()) || this->CrossConfig) { - for (std::string const& config : this->ConfigsList) { + const auto& configs = + processName == "cmake_autorcc" ? this->ConfigsList : autogenConfigs; + for (std::string const& config : configs) { commandLines.push_back( cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E", processName, infoFile, config })); @@ -1629,9 +1633,7 @@ void cmQtAutoGenInitializer::AddCMakeProcessToCommandLines( if (this->MultiConfig) { autoInfoFileConfig = "$"; } else { - std::vector configs; - this->GlobalGen->GetQtAutoGenConfigs(configs); - autoInfoFileConfig = configs[0]; + autoInfoFileConfig = autogenConfigs[0]; } commandLines.push_back( cmMakeCommandLine({ cmSystemTools::GetCMakeCommand(), "-E", processName, diff --git a/Tests/RunCMake/Autogen_common/utils.cmake b/Tests/RunCMake/Autogen_common/utils.cmake index 12088072d1..0692ca5195 100644 --- a/Tests/RunCMake/Autogen_common/utils.cmake +++ b/Tests/RunCMake/Autogen_common/utils.cmake @@ -232,24 +232,33 @@ function(autogen_executable_test exe) set(RunCMake_MAKE_PROGRAM ${CMAKE_COMMAND}) run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config Debug) if (exe STREQUAL "Moc") - set(expected_count 16) - elseif (exe STREQUAL "Uic") set(expected_count 4) + elseif (exe STREQUAL "Uic") + set(expected_count 1) else() set(expected_count 12) endif() expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}") - expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-Auto${exe}") if (exe STREQUAL "Moc" OR exe STREQUAL "Uic") - expect_n_times("${make_program_stdout}" "AutoGen:" 20 "${exe}Example-build-AutoGen:") + expect_n_times("${make_program_stdout}" "AutoGen:" 5 "${exe}Example-build-AutoGen:") endif() - foreach(config IN ITEMS Debug Release RelWithDebInfo) + + foreach(config IN ITEMS Release RelWithDebInfo) block() + # Note: We expect to see Auto${exe} or AutoGen in the output for + # moc and uic because they should be triggered per configuration. + # For rcc, we don't expect to see Auto${exe} or AutoGen in the output + # because all configurations trigger with the first configuration. run_make_program(${RunCMake_TEST_BINARY_DIR} --build . --config ${config}) - not_expect("${make_program_stdout}" "Auto${exe}" "${exe}Example-${config}_Auto${exe}") - not_expect("${make_program_stdout}" "AutoGen:" "${exe}Example-${config}_AutoGen") + if (exe STREQUAL "Moc" OR exe STREQUAL "Uic") + expect_n_times("${make_program_stdout}" "Auto${exe}:" ${expected_count} "${exe}Example-build-${config}-Auto${exe}") + expect_n_times("${make_program_stdout}" "AutoGen" 5 "${exe}Example-build-${config}-AutoGen:") + else() + not_expect("${make_program_stdout}" "Auto${exe}" "${exe}Example-build-${config}_Auto${exe}") + not_expect("${make_program_stdout}" "AutoGen" "${exe}Example-build-${config}_AutoGen") + endif() endblock() endforeach() endblock()