summaryrefslogtreecommitdiff
path: root/Source/cmLocalVisualStudio7Generator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-10 15:47:19 -0400
committerBrad King <brad.king@kitware.com>2014-03-12 10:44:01 -0400
commitbc993f277ebd44fabe8312a85c5682eed011336d (patch)
tree3f385f5257072c0eb18aa64badfe282eb41e3996 /Source/cmLocalVisualStudio7Generator.cxx
parent9a5c55441418ef79415b9a1b99c35192d2b8c1b0 (diff)
downloadcmake-bc993f277ebd44fabe8312a85c5682eed011336d.tar.gz
Generalize cmCustomCommandGenerator to more fields
Until now the cmCustomCommandGenerator was used only to compute the command lines of a custom command. Generalize it to get the comment, working directory, dependencies, and outputs of custom commands. Update use in all generators to support this.
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx24
1 files changed, 13 insertions, 11 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 4491140150..14ad567787 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -18,6 +18,7 @@
#include "cmSourceFile.h"
#include "cmCacheManager.h"
#include "cmGeneratorTarget.h"
+#include "cmCustomCommandGenerator.h"
#include "cmake.h"
#include "cmComputeLinkInformation.h"
@@ -609,9 +610,10 @@ public:
}
void Write(cmCustomCommand const& cc)
{
+ cmCustomCommandGenerator ccg(cc, this->Config, this->LG->GetMakefile());
if(this->First)
{
- const char* comment = cc.GetComment();
+ const char* comment = ccg.GetComment();
if(comment && *comment)
{
this->Stream << "\nDescription=\""
@@ -624,7 +626,7 @@ public:
{
this->Stream << this->LG->EscapeForXML("\n");
}
- std::string script = this->LG->ConstructScript(cc, this->Config);
+ std::string script = this->LG->ConstructScript(ccg);
this->Stream << this->LG->EscapeForXML(script.c_str());
}
private:
@@ -1791,8 +1793,6 @@ WriteCustomRule(std::ostream& fout,
const cmCustomCommand& command,
FCInfo& fcinfo)
{
- std::string comment = this->ConstructComment(command);
-
// Write the rule for each configuration.
std::vector<std::string>::iterator i;
std::vector<std::string> *configs =
@@ -1810,6 +1810,7 @@ WriteCustomRule(std::ostream& fout,
}
for(i = configs->begin(); i != configs->end(); ++i)
{
+ cmCustomCommandGenerator ccg(command, *i, this->Makefile);
cmLVS7GFileConfig const& fc = fcinfo.FileConfigMap[*i];
fout << "\t\t\t\t<FileConfiguration\n";
fout << "\t\t\t\t\tName=\"" << *i << "|" << this->PlatformName << "\">\n";
@@ -1821,7 +1822,8 @@ WriteCustomRule(std::ostream& fout,
<< this->EscapeForXML(fc.CompileFlags.c_str()) << "\"/>\n";
}
- std::string script = this->ConstructScript(command, i->c_str());
+ std::string comment = this->ConstructComment(ccg);
+ std::string script = this->ConstructScript(ccg);
if(this->FortranProject)
{
cmSystemTools::ReplaceString(script, "$(Configuration)", i->c_str());
@@ -1833,7 +1835,7 @@ WriteCustomRule(std::ostream& fout,
<< "\t\t\t\t\tCommandLine=\""
<< this->EscapeForXML(script.c_str()) << "\"\n"
<< "\t\t\t\t\tAdditionalDependencies=\"";
- if(command.GetDepends().empty())
+ if(ccg.GetDepends().empty())
{
// There are no real dependencies. Produce an artificial one to
// make sure the rule runs reliably.
@@ -1848,8 +1850,8 @@ WriteCustomRule(std::ostream& fout,
{
// Write out the dependencies for the rule.
for(std::vector<std::string>::const_iterator d =
- command.GetDepends().begin();
- d != command.GetDepends().end();
+ ccg.GetDepends().begin();
+ d != ccg.GetDepends().end();
++d)
{
// Get the real name of the dependency in case it is a CMake target.
@@ -1863,7 +1865,7 @@ WriteCustomRule(std::ostream& fout,
}
fout << "\"\n";
fout << "\t\t\t\t\tOutputs=\"";
- if(command.GetOutputs().empty())
+ if(ccg.GetOutputs().empty())
{
fout << source << "_force";
}
@@ -1872,8 +1874,8 @@ WriteCustomRule(std::ostream& fout,
// Write a rule for the output generated by this command.
const char* sep = "";
for(std::vector<std::string>::const_iterator o =
- command.GetOutputs().begin();
- o != command.GetOutputs().end();
+ ccg.GetOutputs().begin();
+ o != ccg.GetOutputs().end();
++o)
{
fout << sep << this->ConvertToXMLOutputPathSingle(o->c_str());