mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
cmNinjaTargetGenerator: Reduce lifetime of custom command list
Since commit 2583eff6fe (ninja: Factor out custom command order-only
depends, 2014-03-10, v3.1.0-rc1~559^2) we can store the list of custom
commands in a local variable rather than a member.
This commit is contained in:
@@ -49,6 +49,8 @@
|
||||
#include "cmValue.h"
|
||||
#include "cmake.h"
|
||||
|
||||
class cmCustomCommand;
|
||||
|
||||
std::unique_ptr<cmNinjaTargetGenerator> cmNinjaTargetGenerator::New(
|
||||
cmGeneratorTarget* target)
|
||||
{
|
||||
@@ -972,16 +974,15 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
|
||||
<< cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType())
|
||||
<< " target " << this->GetTargetName() << "\n\n";
|
||||
|
||||
std::vector<cmCustomCommand const*> customCommands;
|
||||
{
|
||||
std::vector<cmSourceFile const*> customCommands;
|
||||
this->GeneratorTarget->GetCustomCommands(customCommands, config);
|
||||
for (cmSourceFile const* sf : customCommands) {
|
||||
std::vector<cmSourceFile const*> customCommandSources;
|
||||
this->GeneratorTarget->GetCustomCommands(customCommandSources, config);
|
||||
for (cmSourceFile const* sf : customCommandSources) {
|
||||
cmCustomCommand const* cc = sf->GetCustomCommand();
|
||||
this->GetLocalGenerator()->AddCustomCommandTarget(
|
||||
cc, this->GetGeneratorTarget());
|
||||
// Record the custom commands for this target. The container is used
|
||||
// in WriteObjectBuildStatement when called in a loop below.
|
||||
this->Configs[config].CustomCommands.push_back(cc);
|
||||
customCommands.push_back(cc);
|
||||
}
|
||||
}
|
||||
{
|
||||
@@ -1028,7 +1029,7 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
|
||||
cm::append(orderOnlyDeps, this->Configs[config].ExtraFiles);
|
||||
|
||||
// Add order-only dependencies on custom command outputs.
|
||||
for (cmCustomCommand const* cc : this->Configs[config].CustomCommands) {
|
||||
for (cmCustomCommand const* cc : customCommands) {
|
||||
cmCustomCommandGenerator ccg(*cc, config, this->GetLocalGenerator());
|
||||
const std::vector<std::string>& ccoutputs = ccg.GetOutputs();
|
||||
const std::vector<std::string>& ccbyproducts = ccg.GetByproducts();
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "cmNinjaTypes.h"
|
||||
#include "cmOSXBundleGenerator.h"
|
||||
|
||||
class cmCustomCommand;
|
||||
class cmGeneratedFileStream;
|
||||
class cmGeneratorTarget;
|
||||
class cmLocalNinjaGenerator;
|
||||
@@ -251,7 +250,6 @@ private:
|
||||
mutable ImportedCxxModuleLookup ImportedCxxModules;
|
||||
// Swift Support
|
||||
Json::Value SwiftOutputMap;
|
||||
std::vector<cmCustomCommand const*> CustomCommands;
|
||||
cmNinjaDeps ExtraFiles;
|
||||
std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user