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

Method WriteObjectConvenienceRule

Source/cmLocalUnixMakefileGenerator3.cxx:375–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373}
374
375void cmLocalUnixMakefileGenerator3::WriteObjectConvenienceRule(
376 std::ostream& ruleFileStream, char const* comment, std::string const& output,
377 LocalObjectInfo const& info)
378{
379 // If the rule includes the source file extension then create a
380 // version that has the extension removed. The help should include
381 // only the version without source extension.
382 bool inHelp = true;
383 if (info.HasSourceExtension) {
384 // Remove the last extension. This should be kept.
385 std::string outBase1 = output;
386 std::string outExt1 = cmSplitExtension(outBase1, outBase1);
387
388 // Now remove the source extension and put back the last
389 // extension.
390 std::string outNoExt;
391 cmSplitExtension(outBase1, outNoExt);
392 outNoExt += outExt1;
393
394 // Add a rule to drive the rule below.
395 std::vector<std::string> depends;
396 depends.emplace_back(output);
397 std::vector<std::string> no_commands;
398 this->WriteMakeRule(ruleFileStream, nullptr, outNoExt, depends,
399 no_commands, true, true);
400 inHelp = false;
401 }
402
403 // Recursively make the rule for each target using the object file.
404 std::vector<std::string> commands;
405 for (LocalObjectEntry const& t : info) {
406 std::string tgtMakefileName = this->GetRelativeTargetDirectory(t.Target);
407 std::string targetName = tgtMakefileName;
408 tgtMakefileName += "/build.make";
409 targetName += "/";
410 targetName += output;
411 commands.push_back(
412 this->GetRecursiveMakeCall(tgtMakefileName, targetName));
413 }
414 this->CreateCDCommand(commands, this->GetBinaryDirectory(),
415 this->GetCurrentBinaryDirectory());
416
417 // Write the rule to the makefile.
418 std::vector<std::string> no_depends;
419 this->WriteMakeRule(ruleFileStream, comment, output, no_depends, commands,
420 true, inHelp);
421}
422
423void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
424 std::ostream& ruleFileStream, std::set<std::string>& emitted)

Callers 1

WriteLocalMakefileMethod · 0.95

Calls 7

WriteMakeRuleMethod · 0.95
GetRecursiveMakeCallMethod · 0.95
CreateCDCommandMethod · 0.95
cmSplitExtensionFunction · 0.85
emplace_backMethod · 0.80
push_backMethod · 0.80

Tested by

no test coverage detected