summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Stürmer <michael.stuermer@schaeffler.com>2017-06-15 12:30:29 (GMT)
committerMichael Stürmer <michael.stuermer@schaeffler.com>2017-06-22 14:52:37 (GMT)
commit0a8f469af921d64431ed237022a02d39cac3ebb5 (patch)
treeaf41fc54e8380cca31cb8c3ce0d9eef735c7fc0a
parent54d42ce7287290b1742c5b7326039ee46dd22cfb (diff)
downloadCMake-0a8f469af921d64431ed237022a02d39cac3ebb5.zip
CMake-0a8f469af921d64431ed237022a02d39cac3ebb5.tar.gz
CMake-0a8f469af921d64431ed237022a02d39cac3ebb5.tar.bz2
Vs: refactor WriteCustomRule for preparation of CSharp support
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx48
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h4
2 files changed, 34 insertions, 18 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 6d796be..d163ddb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1218,43 +1218,55 @@ void cmVisualStudio10TargetGenerator::WriteCustomRule(
std::string comment = lg->ConstructComment(ccg);
comment = cmVS10EscapeComment(comment);
std::string script = cmVS10EscapeXML(lg->ConstructScript(ccg));
- this->WritePlatformConfigTag("Message", i->c_str(), 3);
- (*this->BuildFileStream) << cmVS10EscapeXML(comment) << "</Message>\n";
- this->WritePlatformConfigTag("Command", i->c_str(), 3);
- (*this->BuildFileStream) << script << "</Command>\n";
- this->WritePlatformConfigTag("AdditionalInputs", i->c_str(), 3);
-
- (*this->BuildFileStream) << cmVS10EscapeXML(source->GetFullPath());
+ // input files for custom command
+ std::stringstream inputs;
+ inputs << cmVS10EscapeXML(source->GetFullPath());
for (std::vector<std::string>::const_iterator d = ccg.GetDepends().begin();
d != ccg.GetDepends().end(); ++d) {
std::string dep;
if (this->LocalGenerator->GetRealDependency(d->c_str(), i->c_str(),
dep)) {
this->ConvertToWindowsSlash(dep);
- (*this->BuildFileStream) << ";" << cmVS10EscapeXML(dep);
+ inputs << ";" << cmVS10EscapeXML(dep);
}
}
- (*this->BuildFileStream) << ";%(AdditionalInputs)</AdditionalInputs>\n";
- this->WritePlatformConfigTag("Outputs", i->c_str(), 3);
+ // output files for custom command
+ std::stringstream outputs;
const char* sep = "";
for (std::vector<std::string>::const_iterator o = ccg.GetOutputs().begin();
o != ccg.GetOutputs().end(); ++o) {
std::string out = *o;
this->ConvertToWindowsSlash(out);
- (*this->BuildFileStream) << sep << cmVS10EscapeXML(out);
+ outputs << sep << cmVS10EscapeXML(out);
sep = ";";
}
- (*this->BuildFileStream) << "</Outputs>\n";
- if (this->LocalGenerator->GetVersion() >
- cmGlobalVisualStudioGenerator::VS10) {
- // VS >= 11 let us turn off linking of custom command outputs.
- this->WritePlatformConfigTag("LinkObjects", i->c_str(), 3);
- (*this->BuildFileStream) << "false</LinkObjects>\n";
- }
+ this->WriteCustomRuleCpp(*i, script, inputs.str(), outputs.str(), comment);
}
this->WriteString("</CustomBuild>\n", 2);
}
+void cmVisualStudio10TargetGenerator::WriteCustomRuleCpp(
+ std::string const& config, std::string const& script,
+ std::string const& inputs, std::string const& outputs,
+ std::string const& comment)
+{
+ this->WritePlatformConfigTag("Message", config, 3);
+ (*this->BuildFileStream) << cmVS10EscapeXML(comment) << "</Message>\n";
+ this->WritePlatformConfigTag("Command", config, 3);
+ (*this->BuildFileStream) << script << "</Command>\n";
+ this->WritePlatformConfigTag("AdditionalInputs", config, 3);
+ (*this->BuildFileStream) << inputs;
+ (*this->BuildFileStream) << ";%(AdditionalInputs)</AdditionalInputs>\n";
+ this->WritePlatformConfigTag("Outputs", config, 3);
+ (*this->BuildFileStream) << outputs << "</Outputs>\n";
+ if (this->LocalGenerator->GetVersion() >
+ cmGlobalVisualStudioGenerator::VS10) {
+ // VS >= 11 let us turn off linking of custom command outputs.
+ this->WritePlatformConfigTag("LinkObjects", config, 3);
+ (*this->BuildFileStream) << "false</LinkObjects>\n";
+ }
+}
+
std::string cmVisualStudio10TargetGenerator::ConvertPath(
std::string const& path, bool forceRelative)
{
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 0852459..007c6fa 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -127,6 +127,10 @@ private:
void OutputLinkIncremental(std::string const& configName);
void WriteCustomRule(cmSourceFile const* source,
cmCustomCommand const& command);
+ void WriteCustomRuleCpp(std::string const& config, std::string const& script,
+ std::string const& inputs,
+ std::string const& outputs,
+ std::string const& comment);
void WriteCustomCommands();
void WriteCustomCommand(cmSourceFile const* sf);
void WriteGroups();