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

Method WriteSdkStyleEvent

Source/cmVisualStudio10TargetGenerator.cxx:5074–5123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5072}
5073
5074void cmVisualStudio10TargetGenerator::WriteSdkStyleEvent(
5075 Elem& e0, std::string const& name, std::string const& when,
5076 std::string const& target, std::vector<cmCustomCommand> const& commands,
5077 std::string const& configName)
5078{
5079 if (commands.empty()) {
5080 return;
5081 }
5082 Elem e1(e0, "Target");
5083 e1.Attribute("Condition",
5084 cmStrCat("'$(Configuration)' == '", configName, '\''));
5085 e1.Attribute("Name", name + configName);
5086 e1.Attribute(when.c_str(), target);
5087 e1.SetHasElements();
5088
5089 cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
5090 std::string script;
5091 char const* pre = "";
5092 std::string comment;
5093 bool stdPipesUTF8 = false;
5094 for (cmCustomCommand const& cc : commands) {
5095 cmCustomCommandGenerator ccg(cc, configName, lg);
5096 if (!ccg.HasOnlyEmptyCommandLines()) {
5097 comment += pre;
5098 comment += lg->ConstructComment(ccg);
5099 script += pre;
5100 pre = "\n";
5101 script += lg->ConstructScript(ccg);
5102
5103 stdPipesUTF8 = stdPipesUTF8 || cc.GetStdPipesUTF8();
5104 }
5105 }
5106 if (!script.empty()) {
5107 script += lg->FinishConstructScript(this->ProjectType);
5108 }
5109 comment = cmVS10EscapeComment(comment);
5110
5111 std::string strippedComment = comment;
5112 strippedComment.erase(
5113 std::remove(strippedComment.begin(), strippedComment.end(), '\t'),
5114 strippedComment.end());
5115 std::ostringstream oss;
5116 if (!comment.empty() && !strippedComment.empty()) {
5117 oss << "echo " << comment << "\n";
5118 }
5119 oss << script << "\n";
5120
5121 Elem e2(e1, "Exec");
5122 e2.Attribute("Command", oss.str());
5123}
5124
5125void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0)
5126{

Callers 1

WriteSdkStyleEventsMethod · 0.95

Calls 15

cmVS10EscapeCommentFunction · 0.85
AttributeMethod · 0.80
c_strMethod · 0.80
SetHasElementsMethod · 0.80
ConstructCommentMethod · 0.80
GetStdPipesUTF8Method · 0.80
FinishConstructScriptMethod · 0.80
eraseMethod · 0.80
strMethod · 0.80
cmStrCatFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected