summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalXCodeGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-10 19:47:19 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-12 14:44:01 (GMT)
commitbc993f277ebd44fabe8312a85c5682eed011336d (patch)
tree3f385f5257072c0eb18aa64badfe282eb41e3996 /Source/cmGlobalXCodeGenerator.cxx
parent9a5c55441418ef79415b9a1b99c35192d2b8c1b0 (diff)
downloadCMake-bc993f277ebd44fabe8312a85c5682eed011336d.zip
CMake-bc993f277ebd44fabe8312a85c5682eed011336d.tar.gz
CMake-bc993f277ebd44fabe8312a85c5682eed011336d.tar.bz2
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/cmGlobalXCodeGenerator.cxx')
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx29
1 files changed, 14 insertions, 15 deletions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 2dd31f3..36196a2 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1546,10 +1546,10 @@ void cmGlobalXCodeGenerator
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
- cmCustomCommand const& cc = *i;
- if(!cc.GetCommandLines().empty())
+ cmCustomCommandGenerator ccg(*i, configName, this->CurrentMakefile);
+ if(ccg.GetNumberOfCommands() > 0)
{
- const std::vector<std::string>& outputs = cc.GetOutputs();
+ const std::vector<std::string>& outputs = ccg.GetOutputs();
if(!outputs.empty())
{
for(std::vector<std::string>::const_iterator o = outputs.begin();
@@ -1573,8 +1573,8 @@ void cmGlobalXCodeGenerator
{
cmOStringStream str;
str << "_buildpart_" << count++ ;
- tname[&cc] = std::string(target.GetName()) + str.str();
- makefileStream << "\\\n\t" << tname[&cc];
+ tname[&ccg.GetCC()] = std::string(target.GetName()) + str.str();
+ makefileStream << "\\\n\t" << tname[&ccg.GetCC()];
}
}
}
@@ -1582,12 +1582,11 @@ void cmGlobalXCodeGenerator
for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
- cmCustomCommand const& cc = *i;
- if(!cc.GetCommandLines().empty())
+ cmCustomCommandGenerator ccg(*i, configName, this->CurrentMakefile);
+ if(ccg.GetNumberOfCommands() > 0)
{
- cmCustomCommandGenerator ccg(cc, configName, this->CurrentMakefile);
makefileStream << "\n";
- const std::vector<std::string>& outputs = cc.GetOutputs();
+ const std::vector<std::string>& outputs = ccg.GetOutputs();
if(!outputs.empty())
{
// There is at least one output, start the rule for it
@@ -1598,11 +1597,11 @@ void cmGlobalXCodeGenerator
else
{
// There are no outputs. Use the generated force rule name.
- makefileStream << tname[&cc] << ": ";
+ makefileStream << tname[&ccg.GetCC()] << ": ";
}
for(std::vector<std::string>::const_iterator d =
- cc.GetDepends().begin();
- d != cc.GetDepends().end(); ++d)
+ ccg.GetDepends().begin();
+ d != ccg.GetDepends().end(); ++d)
{
std::string dep;
if(this->CurrentLocalGenerator
@@ -1614,11 +1613,11 @@ void cmGlobalXCodeGenerator
}
makefileStream << "\n";
- if(const char* comment = cc.GetComment())
+ if(const char* comment = ccg.GetComment())
{
std::string echo_cmd = "echo ";
echo_cmd += (this->CurrentLocalGenerator->
- EscapeForShell(comment, cc.GetEscapeAllowMakeVars()));
+ EscapeForShell(comment, ccg.GetCC().GetEscapeAllowMakeVars()));
makefileStream << "\t" << echo_cmd.c_str() << "\n";
}
@@ -1630,7 +1629,7 @@ void cmGlobalXCodeGenerator
cmSystemTools::ReplaceString(cmd2, "/./", "/");
cmd2 = this->ConvertToRelativeForMake(cmd2.c_str());
std::string cmd;
- std::string wd = cc.GetWorkingDirectory();
+ std::string wd = ccg.GetWorkingDirectory();
if(!wd.empty())
{
cmd += "cd ";