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

Method GenerateBuildCommand

Source/cmGlobalGhsMultiGenerator.cxx:468–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

466}
467
468std::vector<cmGlobalGenerator::GeneratedMakeCommand>
469cmGlobalGhsMultiGenerator::GenerateBuildCommand(
470 std::string const& makeProgram, std::string const& projectName,
471 std::string const& projectDir, std::vector<std::string> const& targetNames,
472 std::string const& /*config*/, int jobs, bool verbose,
473 cmBuildOptions /*buildOptions*/, std::vector<std::string> const& makeOptions,
474 BuildTryCompile /*isInTryCompile*/)
475{
476 GeneratedMakeCommand makeCommand;
477
478 makeCommand.Add(this->SelectMakeProgram(makeProgram));
479
480 if (jobs != cmake::NO_BUILD_PARALLEL_LEVEL) {
481 if (jobs == cmake::DEFAULT_BUILD_PARALLEL_LEVEL) {
482 makeCommand.Add("-parallel");
483 } else {
484 makeCommand.Add(std::string("-parallel=") + std::to_string(jobs));
485 }
486 }
487
488 /* determine the top-project file in the project directory */
489 std::string proj = projectName + ".top" + FILE_EXTENSION;
490 std::vector<std::string> files;
491 cmSystemTools::Glob(projectDir, ".*\\.top\\.gpj", files);
492 if (!files.empty()) {
493 /* use the real top-level project in the directory */
494 proj = files.at(0);
495 }
496 makeCommand.Add("-top", proj);
497
498 /* determine targets to build */
499 bool build_all = false;
500 if (!targetNames.empty()) {
501 for (auto const& tname : targetNames) {
502 if (!tname.empty()) {
503 if (tname == "clean") {
504 makeCommand.Add("-clean");
505 } else {
506 makeCommand.Add(tname + ".tgt.gpj");
507 }
508 } else {
509 build_all = true;
510 }
511 }
512 } else {
513 build_all = true;
514 }
515
516 if (build_all) {
517 /* transform name to default build */;
518 std::string all = std::string(this->GetAllTargetName()) + ".tgt.gpj";
519 makeCommand.Add(all);
520 }
521
522 if (verbose) {
523 makeCommand.Add("-commands");
524 }
525 makeCommand.Add(makeOptions.begin(), makeOptions.end());

Callers

nothing calls this directly

Calls 9

to_stringFunction · 0.85
moveFunction · 0.85
SelectMakeProgramMethod · 0.80
AddMethod · 0.45
emptyMethod · 0.45
atMethod · 0.45
GetAllTargetNameMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected