summaryrefslogtreecommitdiffstats
path: root/Source/cmNinjaTargetGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmNinjaTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx29
1 files changed, 15 insertions, 14 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 0b379bd..292a22f 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -502,7 +502,7 @@ cmNinjaTargetGenerator
this->GetLocalGenerator()->AddCustomCommandTarget(cc, this->GetTarget());
// Record the custom commands for this target. The container is used
// in WriteObjectBuildStatement when called in a loop below.
- this->CustomCommands.push_back((*si)->GetCustomCommand());
+ this->CustomCommands.push_back(cc);
}
std::vector<cmSourceFile const*> headerSources;
this->GeneratorTarget->GetHeaderSources(headerSources, config);
@@ -525,6 +525,20 @@ cmNinjaTargetGenerator
cmNinjaDeps orderOnlyDeps;
this->GetLocalGenerator()->AppendTargetDepends(this->Target, orderOnlyDeps);
+
+ // Add order-only dependencies on custom command outputs.
+ for(std::vector<cmCustomCommand const*>::const_iterator
+ cci = this->CustomCommands.begin();
+ cci != this->CustomCommands.end(); ++cci)
+ {
+ cmCustomCommand const* cc = *cci;
+ cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
+ this->GetMakefile());
+ const std::vector<std::string>& ccoutputs = ccg.GetOutputs();
+ std::transform(ccoutputs.begin(), ccoutputs.end(),
+ std::back_inserter(orderOnlyDeps), MapToNinjaPath());
+ }
+
cmNinjaDeps orderOnlyTarget;
orderOnlyTarget.push_back(this->OrderDependsTargetForTarget());
this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(),
@@ -584,19 +598,6 @@ cmNinjaTargetGenerator
cmNinjaDeps orderOnlyDeps;
orderOnlyDeps.push_back(this->OrderDependsTargetForTarget());
- // Add order-only dependencies on custom command outputs.
- for(std::vector<cmCustomCommand const*>::const_iterator
- cci = this->CustomCommands.begin();
- cci != this->CustomCommands.end(); ++cci)
- {
- cmCustomCommand const* cc = *cci;
- cmCustomCommandGenerator ccg(*cc, this->GetConfigName(),
- this->GetMakefile());
- const std::vector<std::string>& ccoutputs = ccg.GetOutputs();
- std::transform(ccoutputs.begin(), ccoutputs.end(),
- std::back_inserter(orderOnlyDeps), MapToNinjaPath());
- }
-
// If the source file is GENERATED and does not have a custom command
// (either attached to this source file or another one), assume that one of
// the target dependencies, OBJECT_DEPENDS or header file custom commands