| 571 | } |
| 572 | |
| 573 | void cmLocalNinjaGenerator::AppendCustomCommandLines( |
| 574 | cmCustomCommandGenerator const& ccg, std::vector<std::string>& cmdLines) |
| 575 | { |
| 576 | auto* gg = this->GetGlobalNinjaGenerator(); |
| 577 | |
| 578 | if (ccg.GetNumberOfCommands() > 0) { |
| 579 | std::string wd = ccg.GetWorkingDirectory(); |
| 580 | if (wd.empty()) { |
| 581 | wd = this->GetCurrentBinaryDirectory(); |
| 582 | } |
| 583 | |
| 584 | std::ostringstream cdCmd; |
| 585 | #ifdef _WIN32 |
| 586 | std::string cdStr = "cd /D "; |
| 587 | #else |
| 588 | std::string cdStr = "cd "; |
| 589 | #endif |
| 590 | cdCmd << cdStr |
| 591 | << this->ConvertToOutputFormat(wd, cmOutputConverter::SHELL); |
| 592 | cmdLines.push_back(cdCmd.str()); |
| 593 | } |
| 594 | |
| 595 | std::string launcher = this->MakeCustomLauncher(ccg); |
| 596 | |
| 597 | for (unsigned i = 0; i != ccg.GetNumberOfCommands(); ++i) { |
| 598 | std::string c = ccg.GetCommand(i); |
| 599 | if (c.empty()) { |
| 600 | continue; |
| 601 | } |
| 602 | cmdLines.push_back(launcher + |
| 603 | this->ConvertToOutputFormat( |
| 604 | c, |
| 605 | gg->IsMultiConfig() ? cmOutputConverter::NINJAMULTI |
| 606 | : cmOutputConverter::SHELL)); |
| 607 | |
| 608 | std::string& cmd = cmdLines.back(); |
| 609 | ccg.AppendArguments(i, cmd); |
| 610 | } |
| 611 | } |
| 612 | |
| 613 | void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( |
| 614 | cmCustomCommand const* cc, std::set<cmGeneratorTarget*> const& targets, |
no test coverage detected