summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrkun Tokdemir <ilhanorkuntokdemir@gmail.com>2023-05-25 15:33:32 (GMT)
committerOrkun Tokdemir <ilhanorkuntokdemir@gmail.com>2023-05-26 14:11:12 (GMT)
commit3bd605f3d06b8ac39f517b5a105c5254ca3ec12b (patch)
tree15f3350a9844eaaa938651ae7c9c83487cb07404
parentf2f21c5752e9b1283576d0278cb5018db36f1946 (diff)
downloadCMake-3bd605f3d06b8ac39f517b5a105c5254ca3ec12b.zip
CMake-3bd605f3d06b8ac39f517b5a105c5254ca3ec12b.tar.gz
CMake-3bd605f3d06b8ac39f517b5a105c5254ca3ec12b.tar.bz2
Autogen: Optimize cmake_autogen execution for CROSS_CONFIG usage
The redundant `cmake_autogen` process execution was optimized for non-`CROSS_CONFIGS` usage. It was executed three times for each config although only one of them is needed.
-rw-r--r--Source/cmQtAutoGenInitializer.cxx20
1 files changed, 17 insertions, 3 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index bac3f5b..62d7ffb 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1168,7 +1168,8 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
if (this->Moc.Enabled) {
this->AddGeneratedSource(this->Moc.CompilationFile, this->Moc, true);
if (useNinjaDepfile) {
- if (this->MultiConfig) {
+ if (this->MultiConfig &&
+ !this->Makefile->GetSafeDefinition("CMAKE_CROSS_CONFIGS").empty()) {
// Make all mocs_compilation_<CONFIG>.cpp files byproducts of the
// ${target}_autogen/timestamp custom command.
// We cannot just use Moc.CompilationFileGenex here, because that
@@ -1215,10 +1216,23 @@ bool cmQtAutoGenInitializer::InitAutogenTarget()
this->GlobalGen->GetQtAutoGenConfigs(configs);
bool constexpr stdPipesUTF8 = true;
cmCustomCommandLines commandLines;
- for (auto const& config : configs) {
+ if (this->Makefile->GetSafeDefinition("CMAKE_CROSS_CONFIGS").empty()) {
+ std::string autugenInfoFileconfig;
+ if (this->MultiConfig) {
+ autugenInfoFileconfig = "$<CONFIG>";
+ } else {
+ autugenInfoFileconfig = configs[0];
+ }
commandLines.push_back(cmMakeCommandLine(
{ cmSystemTools::GetCMakeCommand(), "-E", "cmake_autogen",
- this->AutogenTarget.InfoFile, config }));
+ this->AutogenTarget.InfoFile, autugenInfoFileconfig }));
+
+ } else {
+ for (auto const& config : configs) {
+ commandLines.push_back(cmMakeCommandLine(
+ { cmSystemTools::GetCMakeCommand(), "-E", "cmake_autogen",
+ this->AutogenTarget.InfoFile, config }));
+ }
}
// Use PRE_BUILD on demand