diff options
Diffstat (limited to 'Source/cmNinjaUtilityTargetGenerator.cxx')
-rw-r--r-- | Source/cmNinjaUtilityTargetGenerator.cxx | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx index f5d18dc..42d6b46 100644 --- a/Source/cmNinjaUtilityTargetGenerator.cxx +++ b/Source/cmNinjaUtilityTargetGenerator.cxx @@ -27,14 +27,19 @@ cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() {} void cmNinjaUtilityTargetGenerator::Generate() { + std::string utilCommandName = cmake::GetCMakeFilesDirectoryPostSlash(); + utilCommandName += this->GetTargetName() + ".util"; + std::vector<std::string> commands; - cmNinjaDeps deps, outputs; + cmNinjaDeps deps, outputs, util_outputs(1, utilCommandName); const std::vector<cmCustomCommand> *cmdLists[2] = { &this->GetTarget()->GetPreBuildCommands(), &this->GetTarget()->GetPostBuildCommands() }; + bool uses_terminal = false; + for (unsigned i = 0; i != 2; ++i) { for (std::vector<cmCustomCommand>::const_iterator ci = cmdLists[i]->begin(); ci != cmdLists[i]->end(); ++ci) { @@ -42,6 +47,11 @@ void cmNinjaUtilityTargetGenerator::Generate() this->GetMakefile()); this->GetLocalGenerator()->AppendCustomCommandDeps(ccg, deps); this->GetLocalGenerator()->AppendCustomCommandLines(ccg, commands); + std::vector<std::string> const& ccByproducts = ccg.GetByproducts(); + std::transform(ccByproducts.begin(), ccByproducts.end(), + std::back_inserter(util_outputs), MapToNinjaPath()); + if (ci->GetUsesTerminal()) + uses_terminal = true; } } @@ -60,8 +70,11 @@ void cmNinjaUtilityTargetGenerator::Generate() // Depend on all custom command outputs. const std::vector<std::string>& ccOutputs = ccg.GetOutputs(); + const std::vector<std::string>& ccByproducts = ccg.GetByproducts(); std::transform(ccOutputs.begin(), ccOutputs.end(), std::back_inserter(deps), MapToNinjaPath()); + std::transform(ccByproducts.begin(), ccByproducts.end(), + std::back_inserter(deps), MapToNinjaPath()); } } @@ -103,14 +116,19 @@ void cmNinjaUtilityTargetGenerator::Generate() if (command.find('$') != std::string::npos) return; - std::string utilCommandName = cmake::GetCMakeFilesDirectoryPostSlash(); - utilCommandName += this->GetTargetName() + ".util"; + for (cmNinjaDeps::const_iterator + oi = util_outputs.begin(), oe = util_outputs.end(); + oi != oe; ++oi) + { + this->GetGlobalGenerator()->SeenCustomCommandOutput(*oi); + } this->GetGlobalGenerator()->WriteCustomCommandBuild( command, desc, "Utility command for " + this->GetTargetName(), - cmNinjaDeps(1, utilCommandName), + uses_terminal, + util_outputs, deps); this->GetGlobalGenerator()->WritePhonyBuild(this->GetBuildFileStream(), |