diff options
author | Brad King <brad.king@kitware.com> | 2018-08-06 12:43:46 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-08-06 12:43:54 (GMT) |
commit | 1d76991a412873aa3a0aed9735a06d658ef367e7 (patch) | |
tree | 04babf38eb511a4a159b9dcdd8071d3fed843adc /Source/cmGlobalGenerator.cxx | |
parent | d7a1bcd2e67e27d8897c100f14744547ef639d64 (diff) | |
parent | 87e7904c915976456028fcd834bdea9bf07b47fd (diff) | |
download | CMake-1d76991a412873aa3a0aed9735a06d658ef367e7.zip CMake-1d76991a412873aa3a0aed9735a06d658ef367e7.tar.gz CMake-1d76991a412873aa3a0aed9735a06d658ef367e7.tar.bz2 |
Merge topic 'autogen_single_entry'
87e7904c91 Autogen: Use a single AUTOGEN setup function in cmGlobalGenerator
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2260
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 63bbf04..58821c2 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1313,16 +1313,10 @@ bool cmGlobalGenerator::Compute() // so create the map from project name to vector of local generators this->FillProjectMap(); -#ifdef CMAKE_BUILD_WITH_CMAKE - // Iterate through all targets and set up automoc for those which have - // the AUTOMOC, AUTOUIC or AUTORCC property set - auto autogenInits = this->CreateQtAutoGenInitializers(); - for (auto& autoGen : autogenInits) { - if (!autoGen->InitCustomTargets()) { - return false; - } + // Iterate through all targets and set up AUTOMOC, AUTOUIC and AUTORCC + if (!this->QtAutoGen()) { + return false; } -#endif // Add generator specific helper commands for (cmLocalGenerator* localGen : this->LocalGenerators) { @@ -1341,16 +1335,6 @@ bool cmGlobalGenerator::Compute() } } -#ifdef CMAKE_BUILD_WITH_CMAKE - for (auto& autoGen : autogenInits) { - if (!autoGen->SetupCustomTargets()) { - return false; - } - autoGen.reset(nullptr); - } - autogenInits.clear(); -#endif - for (cmLocalGenerator* localGen : this->LocalGenerators) { cmMakefile* mf = localGen->GetMakefile(); for (cmInstallGenerator* g : mf->GetInstallGenerators()) { @@ -1480,12 +1464,11 @@ bool cmGlobalGenerator::ComputeTargetDepends() return true; } -std::vector<std::unique_ptr<cmQtAutoGenInitializer>> -cmGlobalGenerator::CreateQtAutoGenInitializers() +bool cmGlobalGenerator::QtAutoGen() { +#ifdef CMAKE_BUILD_WITH_CMAKE std::vector<std::unique_ptr<cmQtAutoGenInitializer>> autogenInits; -#ifdef CMAKE_BUILD_WITH_CMAKE for (cmLocalGenerator* localGen : this->LocalGenerators) { const std::vector<cmGeneratorTarget*>& targets = localGen->GetGeneratorTargets(); @@ -1519,12 +1502,30 @@ cmGlobalGenerator::CreateQtAutoGenInitializers() continue; } - autogenInits.emplace_back(new cmQtAutoGenInitializer( + autogenInits.emplace_back(cm::make_unique<cmQtAutoGenInitializer>( target, mocEnabled, uicEnabled, rccEnabled, qtVersionMajor)); } } + + if (!autogenInits.empty()) { + // Initialize custom targets + for (auto& autoGen : autogenInits) { + if (!autoGen->InitCustomTargets()) { + return false; + } + } + + // Setup custom targets + for (auto& autoGen : autogenInits) { + if (!autoGen->SetupCustomTargets()) { + return false; + } + autoGen.reset(nullptr); + } + } #endif - return autogenInits; + + return true; } cmLinkLineComputer* cmGlobalGenerator::CreateLinkLineComputer( |