Add support for comments on custom commands in visual studio 7

This commit is contained in:
Andy Cedilnik 2002-12-10 17:43:34 -05:00
parent 3893ee72d2
commit b0656a2605
2 changed files with 17 additions and 4 deletions

View File

@ -680,7 +680,9 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
std::string totalCommandStr; std::string totalCommandStr;
totalCommandStr = this->CombineCommands(commands, totalCommand, totalCommandStr = this->CombineCommands(commands, totalCommand,
source.c_str()); source.c_str());
const char* comment = totalCommand.m_Comment.c_str();
this->WriteCustomRule(fout, source.c_str(), totalCommandStr.c_str(), this->WriteCustomRule(fout, source.c_str(), totalCommandStr.c_str(),
(*comment?comment:"Custom Rule"),
totalCommand.m_Depends, totalCommand.m_Depends,
totalCommand.m_Outputs, compileFlags); totalCommand.m_Outputs, compileFlags);
} }
@ -718,6 +720,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
void cmLocalVisualStudio7Generator::WriteCustomRule(std::ostream& fout, void cmLocalVisualStudio7Generator::WriteCustomRule(std::ostream& fout,
const char* source, const char* source,
const char* command, const char* command,
const char* comment,
const std::set<std::string>& depends, const std::set<std::string>& depends,
const std::set<std::string>& outputs, const std::set<std::string>& outputs,
const char* compileFlags) const char* compileFlags)
@ -740,6 +743,13 @@ void cmLocalVisualStudio7Generator::WriteCustomRule(std::ostream& fout,
} }
fout << "\t\t\t\t\t<Tool\n" fout << "\t\t\t\t\t<Tool\n"
<< "\t\t\t\t\tName=\"VCCustomBuildTool\"\n" << "\t\t\t\t\tName=\"VCCustomBuildTool\"\n"
<< "\t\t\t\t\tDescription=\"Building " << comment;
std::set<std::string>::const_iterator it;
for ( it = outputs.begin(); it != outputs.end(); it ++ )
{
fout << " " << *it;
}
fout << "\"\n"
<< "\t\t\t\t\tCommandLine=\"" << cmd << "\n\"\n" << "\t\t\t\t\tCommandLine=\"" << cmd << "\n\"\n"
<< "\t\t\t\t\tAdditionalDependencies=\""; << "\t\t\t\t\tAdditionalDependencies=\"";
// Write out the dependencies for the rule. // Write out the dependencies for the rule.
@ -798,7 +808,8 @@ void cmLocalVisualStudio7Generator::WriteVCProjEndGroup(std::ostream& fout)
std::string std::string
cmLocalVisualStudio7Generator::CombineCommands(const cmSourceGroup::Commands &commands, cmLocalVisualStudio7Generator::CombineCommands(
const cmSourceGroup::Commands &commands,
cmSourceGroup::CommandFiles &totalCommand, cmSourceGroup::CommandFiles &totalCommand,
const char *source) const char *source)
@ -818,6 +829,7 @@ cmLocalVisualStudio7Generator::CombineCommands(const cmSourceGroup::Commands &co
totalCommandStr += c->second.m_Arguments; totalCommandStr += c->second.m_Arguments;
totalCommandStr += "\n"; totalCommandStr += "\n";
totalCommand.Merge(c->second); totalCommand.Merge(c->second);
totalCommand.m_Comment = c->second.m_Comment.c_str();
} }
// Create a dummy file with the name of the source if it does // Create a dummy file with the name of the source if it does
// not exist // not exist

View File

@ -111,6 +111,7 @@ private:
void WriteCustomRule(std::ostream& fout, void WriteCustomRule(std::ostream& fout,
const char* source, const char* source,
const char* command, const char* command,
const char* comment,
const std::set<std::string>& depends, const std::set<std::string>& depends,
const std::set<std::string>& outputs, const std::set<std::string>& outputs,
const char* extraFlags); const char* extraFlags);