MCPcopy Create free account
hub / github.com/Kitware/CMake / AppendCustomCommandLines

Method AppendCustomCommandLines

Source/cmLocalNinjaGenerator.cxx:573–611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571}
572
573void 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
613void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement(
614 cmCustomCommand const* cc, std::set<cmGeneratorTarget*> const& targets,

Callers 3

WriteLinkStatementMethod · 0.80

Calls 12

MakeCustomLauncherMethod · 0.95
GetNumberOfCommandsMethod · 0.80
push_backMethod · 0.80
strMethod · 0.80
AppendArgumentsMethod · 0.80
GetWorkingDirectoryMethod · 0.45
emptyMethod · 0.45
ConvertToOutputFormatMethod · 0.45
GetCommandMethod · 0.45
IsMultiConfigMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected