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

Method WriteLocalMakefileTargets

Source/cmLocalUnixMakefileGenerator3.cxx:423–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

421}
422
423void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
424 std::ostream& ruleFileStream, std::set<std::string>& emitted)
425{
426 std::vector<std::string> depends;
427 std::vector<std::string> commands;
428
429 // for each target we just provide a rule to cd up to the top and do a make
430 // on the target
431 std::string localName;
432 for (auto const& target : this->GetGeneratorTargets()) {
433 if ((target->GetType() == cmStateEnums::EXECUTABLE) ||
434 (target->GetType() == cmStateEnums::STATIC_LIBRARY) ||
435 (target->GetType() == cmStateEnums::SHARED_LIBRARY) ||
436 (target->GetType() == cmStateEnums::MODULE_LIBRARY) ||
437 (target->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
438 (target->GetType() == cmStateEnums::UTILITY)) {
439 emitted.insert(target->GetName());
440
441 // for subdirs add a rule to build this specific target by name.
442 localName =
443 cmStrCat(this->GetRelativeTargetDirectory(target.get()), "/rule");
444 commands.clear();
445 depends.clear();
446
447 // Build the target for this pass.
448 std::string makefile2 = "CMakeFiles/Makefile2";
449 commands.push_back(this->GetRecursiveMakeCall(makefile2, localName));
450 this->CreateCDCommand(commands, this->GetBinaryDirectory(),
451 this->GetCurrentBinaryDirectory());
452 this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
453 localName, depends, commands, true);
454
455 // Add a target with the canonical name (no prefix, suffix or path).
456 if (localName != target->GetName()) {
457 commands.clear();
458 depends.push_back(localName);
459 this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
460 target->GetName(), depends, commands, true);
461 }
462
463 // Add a fast rule to build the target
464 std::string makefileName = cmStrCat(
465 this->GetRelativeTargetDirectory(target.get()), "/build.make");
466 // make sure the makefile name is suitable for a makefile
467 std::string makeTargetName =
468 cmStrCat(this->GetRelativeTargetDirectory(target.get()), "/build");
469 localName = cmStrCat(target->GetName(), "/fast");
470 depends.clear();
471 commands.clear();
472 commands.push_back(
473 this->GetRecursiveMakeCall(makefileName, makeTargetName));
474 this->CreateCDCommand(commands, this->GetBinaryDirectory(),
475 this->GetCurrentBinaryDirectory());
476 this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
477 localName, depends, commands, true);
478
479 // Add a local name for the rule to relink the target before
480 // installation.

Callers 1

WriteLocalMakefileMethod · 0.95

Calls 12

GetRecursiveMakeCallMethod · 0.95
CreateCDCommandMethod · 0.95
WriteMakeRuleMethod · 0.95
push_backMethod · 0.80
cmStrCatFunction · 0.70
GetTypeMethod · 0.45
insertMethod · 0.45
GetNameMethod · 0.45
getMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected